QuickRank
v2.0
QuickRank: A C++ suite of Learning to Rank algorithms
|
This implements various strategies for pruning ensembles. More...
#include <cleaver.h>
Public Types | |
enum | PruningMethod { PruningMethod::RANDOM, PruningMethod::LOW_WEIGHTS, PruningMethod::SKIP, PruningMethod::LAST, PruningMethod::QUALITY_LOSS, PruningMethod::SCORE_LOSS } |
Public Types inherited from quickrank::optimization::Optimization | |
enum | OptimizationAlgorithm { OptimizationAlgorithm::EPRUNING } |
Public Member Functions | |
Cleaver (double pruning_rate) | |
Cleaver (double pruning_rate, std::shared_ptr< learning::linear::LineSearch > lineSearch) | |
Cleaver (const pugi::xml_document &model) | |
std::string | name () const |
Returns the name of the optimizer. More... | |
virtual PruningMethod | pruning_method () const =0 |
Returns the pruning method of the algorithm. More... | |
virtual bool | line_search_pre_pruning () const =0 |
virtual bool | need_partial_score_dataset () const |
virtual void | pruning (std::set< unsigned int > &pruned_estimators, std::shared_ptr< data::Dataset > dataset, std::shared_ptr< metric::ir::Metric > scorer)=0 |
void | optimize (std::shared_ptr< quickrank::learning::LTR_Algorithm > algo, std::shared_ptr< quickrank::data::Dataset > training_dataset, std::shared_ptr< quickrank::data::Dataset > validation_dataset, std::shared_ptr< quickrank::metric::ir::Metric > metric, size_t partial_save, const std::string model_filename) |
virtual std::shared_ptr< data::Dataset > | filter_dataset (std::shared_ptr< data::Dataset > dataset, std::set< unsigned int > &pruned_estimators) const |
Process the dataset filtering out features with 0-weight. More... | |
virtual pugi::xml_document * | get_xml_model () const |
Return the xml model representing the current object. More... | |
virtual std::vector< float > & | get_weigths () |
Returns the learned weights. More... | |
Public Member Functions inherited from quickrank::optimization::post_learning::PostLearningOptimization | |
bool | is_pre_learning () const |
Public Member Functions inherited from quickrank::optimization::Optimization | |
Optimization () | |
Optimization (const pugi::xml_document &model) | |
Generates a LTR_Algorithm instance from a previously saved XML model. More... | |
virtual | ~Optimization ()=default |
Optimization (const Optimization &other)=delete | |
Avoid inefficient copy constructor. More... | |
Optimization & | operator= (const Optimization &)=delete |
Avoid inefficient copy assignment. More... | |
virtual void | optimize (std::shared_ptr< learning::LTR_Algorithm > algo, std::shared_ptr< data::Dataset > training_dataset, std::shared_ptr< data::Dataset > validation_dataset, std::shared_ptr< metric::ir::Metric > metric, size_t partial_save, const std::string model_filename)=0 |
Executes the optimization process. More... | |
virtual void | save (std::string model_filename, int suffix=-1) const |
Save the current model to the output_file. More... | |
Static Public Member Functions | |
static PruningMethod | getPruningMethod (std::string name) |
static std::string | getPruningMethod (PruningMethod pruningMethod) |
Static Public Member Functions inherited from quickrank::optimization::Optimization | |
static std::shared_ptr< Optimization > | load_model_from_file (std::string model_filename) |
Load a model from a given XML file. More... | |
static OptimizationAlgorithm | getOptimizationAlgorithm (std::string name) |
static std::string | getPruningMethod (OptimizationAlgorithm optAlgo) |
Static Public Attributes | |
static const std::vector< std::string > | pruningMethodNames |
static const std::string | NAME_ = "CLEAVER" |
Static Public Attributes inherited from quickrank::optimization::Optimization | |
static const std::vector< std::string > | optimizationAlgorithmNames |
Protected Member Functions | |
std::ostream & | put (std::ostream &os) const |
Prints the description of Algorithm, including its parameters. More... | |
virtual void | score (data::Dataset *dataset, Score *scores) const |
virtual void | import_weights_from_line_search (std::set< unsigned int > &pruned_estimators) |
Protected Attributes | |
double | pruning_rate_ |
unsigned int | estimators_to_prune_ |
unsigned int | estimators_to_select_ |
std::shared_ptr< learning::linear::LineSearch > | lineSearch_ |
std::vector< float > | weights_ |
This implements various strategies for pruning ensembles.
This optimization algorithm expect the datasets to be in the partial scores format (i.e., a column for each ensemble, with the partial score returned by that ensamble on each document (row of the original dataset)
quickrank::optimization::post_learning::pruning::Cleaver::Cleaver | ( | double | pruning_rate | ) |
quickrank::optimization::post_learning::pruning::Cleaver::Cleaver | ( | double | pruning_rate, |
std::shared_ptr< learning::linear::LineSearch > | lineSearch | ||
) |
quickrank::optimization::post_learning::pruning::Cleaver::Cleaver | ( | const pugi::xml_document & | model | ) |
|
virtual |
Process the dataset filtering out features with 0-weight.
|
inlinevirtual |
Returns the learned weights.
|
virtual |
Return the xml model representing the current object.
Implements quickrank::optimization::Optimization.
|
inlinestatic |
|
inlinestatic |
|
protectedvirtual |
|
pure virtual |
Implemented in quickrank::optimization::post_learning::pruning::LowWeightsPruning, quickrank::optimization::post_learning::pruning::QualityLossPruning, quickrank::optimization::post_learning::pruning::RandomPruning, quickrank::optimization::post_learning::pruning::ScoreLossPruning, quickrank::optimization::post_learning::pruning::LastPruning, and quickrank::optimization::post_learning::pruning::SkipPruning.
|
inlinevirtual |
Returns the name of the optimizer.
Implements quickrank::optimization::Optimization.
|
inlinevirtual |
Implements quickrank::optimization::Optimization.
void quickrank::optimization::post_learning::pruning::Cleaver::optimize | ( | std::shared_ptr< quickrank::learning::LTR_Algorithm > | algo, |
std::shared_ptr< quickrank::data::Dataset > | training_dataset, | ||
std::shared_ptr< quickrank::data::Dataset > | validation_dataset, | ||
std::shared_ptr< quickrank::metric::ir::Metric > | metric, | ||
size_t | partial_save, | ||
const std::string | model_filename | ||
) |
|
pure virtual |
Implemented in quickrank::optimization::post_learning::pruning::LowWeightsPruning, quickrank::optimization::post_learning::pruning::QualityLossPruning, quickrank::optimization::post_learning::pruning::RandomPruning, quickrank::optimization::post_learning::pruning::ScoreLossPruning, quickrank::optimization::post_learning::pruning::LastPruning, and quickrank::optimization::post_learning::pruning::SkipPruning.
|
pure virtual |
Returns the pruning method of the algorithm.
Implemented in quickrank::optimization::post_learning::pruning::LowWeightsPruning, quickrank::optimization::post_learning::pruning::QualityLossPruning, quickrank::optimization::post_learning::pruning::RandomPruning, quickrank::optimization::post_learning::pruning::ScoreLossPruning, quickrank::optimization::post_learning::pruning::LastPruning, and quickrank::optimization::post_learning::pruning::SkipPruning.
|
protectedvirtual |
Prints the description of Algorithm, including its parameters.
Implements quickrank::optimization::Optimization.
|
protectedvirtual |
|
protected |
|
protected |
|
protected |
|
static |
|
protected |
|
static |
|
protected |