QuickRank  v2.0
QuickRank: A C++ suite of Learning to Rank algorithms
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
quickrank::optimization::Optimization Class Referenceabstract

#include <optimization.h>

Inheritance diagram for quickrank::optimization::Optimization:
quickrank::optimization::post_learning::PostLearningOptimization quickrank::optimization::pre_learning::PreLearningOptimization quickrank::optimization::post_learning::pruning::Cleaver quickrank::optimization::post_learning::pruning::LastPruning 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::SkipPruning

Public Types

enum  OptimizationAlgorithm { OptimizationAlgorithm::EPRUNING }
 

Public Member Functions

 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...
 
Optimizationoperator= (const Optimization &)=delete
 Avoid inefficient copy assignment. More...
 
virtual std::string name () const =0
 Returns the name of the optimizer. More...
 
virtual bool need_partial_score_dataset () const =0
 
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...
 
virtual pugi::xml_document * get_xml_model () const =0
 Return the xml model representing the current object. More...
 
virtual bool is_pre_learning () const =0
 

Static Public Member Functions

static std::shared_ptr< Optimizationload_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 > optimizationAlgorithmNames
 

Protected Member Functions

virtual std::ostream & put (std::ostream &os) const =0
 Prints the description of Algorithm, including its parameters. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const Optimization &a)
 The output stream operator. More...
 

Member Enumeration Documentation

Enumerator
EPRUNING 

Constructor & Destructor Documentation

quickrank::optimization::Optimization::Optimization ( )
inline
quickrank::optimization::Optimization::Optimization ( const pugi::xml_document &  model)

Generates a LTR_Algorithm instance from a previously saved XML model.

virtual quickrank::optimization::Optimization::~Optimization ( )
virtualdefault
quickrank::optimization::Optimization::Optimization ( const Optimization other)
delete

Avoid inefficient copy constructor.

Member Function Documentation

virtual pugi::xml_document* quickrank::optimization::Optimization::get_xml_model ( ) const
pure virtual

Return the xml model representing the current object.

Implemented in quickrank::optimization::post_learning::pruning::Cleaver.

static OptimizationAlgorithm quickrank::optimization::Optimization::getOptimizationAlgorithm ( std::string  name)
inlinestatic
static std::string quickrank::optimization::Optimization::getPruningMethod ( OptimizationAlgorithm  optAlgo)
inlinestatic
virtual bool quickrank::optimization::Optimization::is_pre_learning ( ) const
pure virtual
std::shared_ptr< Optimization > quickrank::optimization::Optimization::load_model_from_file ( std::string  model_filename)
static

Load a model from a given XML file.

Parameters
model_filenameThe input file name.
virtual std::string quickrank::optimization::Optimization::name ( ) const
pure virtual

Returns the name of the optimizer.

Implemented in quickrank::optimization::post_learning::pruning::Cleaver.

virtual bool quickrank::optimization::Optimization::need_partial_score_dataset ( ) const
pure virtual
Optimization& quickrank::optimization::Optimization::operator= ( const Optimization )
delete

Avoid inefficient copy assignment.

virtual void quickrank::optimization::Optimization::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 
)
pure virtual

Executes the optimization process.

Parameters
training_datasetThe training dataset.
validation_datasetThe validation dataset.
metricThe metric to be optimized.
partial_saveAllows to save a partial model every given number of iterations.
model_filenameThe file where the model, and the partial models, are saved.
virtual std::ostream& quickrank::optimization::Optimization::put ( std::ostream &  os) const
protectedpure virtual

Prints the description of Algorithm, including its parameters.

Implemented in quickrank::optimization::post_learning::pruning::Cleaver.

void quickrank::optimization::Optimization::save ( std::string  model_filename,
int  suffix = -1 
) const
virtual

Save the current model to the output_file.

Parameters
model_filenameThe output file name.
suffixThe suffix used to identify partial model saves.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const Optimization a 
)
friend

The output stream operator.

Member Data Documentation

const std::vector< std::string > quickrank::optimization::Optimization::optimizationAlgorithmNames
static
Initial value:
= {
"EPRUNING"
}

The documentation for this class was generated from the following files: