QuickRank
v2.0
QuickRank: A C++ suite of Learning to Rank algorithms
|
#include <ltr_algorithm.h>
Public Member Functions | |
LTR_Algorithm () | |
LTR_Algorithm (const pugi::xml_document &model) | |
Generates a LTR_Algorithm instance from a previously saved XML model. More... | |
virtual | ~LTR_Algorithm () |
LTR_Algorithm (const LTR_Algorithm &other)=delete | |
Avoid inefficient copy constructor. More... | |
LTR_Algorithm & | operator= (const LTR_Algorithm &)=delete |
Avoid inefficient copy assignment. More... | |
virtual std::string | name () const =0 |
Returns the name of the ranker. More... | |
virtual void | learn (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 learning process. More... | |
virtual void | score_dataset (std::shared_ptr< data::Dataset > dataset, Score *scores) const |
Given and input dateset, the current ranker generates scores for each instance and store the in the scores vector. More... | |
virtual Score | score_document (const Feature *d) const =0 |
Returns the score of a given document. More... | |
virtual std::shared_ptr< std::vector< Score > > | partial_scores_document (const Feature *d) const |
Returns the partial score of a given document, tree by tree. 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 void | print_additional_stats (void) const |
Print additional statistics. More... | |
virtual bool | update_weights (std::shared_ptr< std::vector< double >> weights) |
Update the weights for the ensemble models (only). More... | |
virtual std::shared_ptr< std::vector< double > > | get_weights () const |
Return the weights for the ensemble models (only). More... | |
Static Public Member Functions | |
static std::shared_ptr< LTR_Algorithm > | load_model_from_file (std::string model_filename) |
Load a model from a given XML file. More... | |
Private 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 LTR_Algorithm &a) |
The output stream operator. More... | |
|
inline |
quickrank::learning::LTR_Algorithm::LTR_Algorithm | ( | const pugi::xml_document & | model | ) |
Generates a LTR_Algorithm instance from a previously saved XML model.
|
inlinevirtual |
|
delete |
Avoid inefficient copy constructor.
|
inlinevirtual |
Return the weights for the ensemble models (only).
Default implementation will do nothing (default for non ensemble models).
Reimplemented in quickrank::learning::forests::Rankboost, quickrank::learning::forests::Mart, quickrank::learning::linear::LineSearch, and quickrank::learning::linear::CoordinateAscent.
|
pure virtual |
Return the xml model representing the current object.
Implemented in quickrank::learning::forests::Mart, quickrank::learning::forests::Rankboost, quickrank::learning::linear::LineSearch, quickrank::learning::CustomLTR, quickrank::learning::linear::CoordinateAscent, quickrank::learning::forests::ObliviousMart, and quickrank::learning::forests::ObliviousLambdaMart.
|
pure virtual |
Executes the learning process.
training_dataset | The training dataset. |
validation_dataset | The validation training dataset. |
metric | The metric to be optimized. |
partial_save | Allows to save a partial model every given number of iterations. |
model_filename | The file where the model, and the partial models, are saved. |
Implemented in quickrank::learning::forests::Rankboost, quickrank::learning::linear::LineSearch, quickrank::learning::CustomLTR, quickrank::learning::linear::CoordinateAscent, and quickrank::learning::forests::Mart.
|
static |
Load a model from a given XML file.
model_filename | The input file name. |
|
pure virtual |
Returns the name of the ranker.
Implemented in quickrank::learning::forests::Rankboost, quickrank::learning::forests::Mart, quickrank::learning::forests::LambdaMart, quickrank::learning::forests::ObliviousLambdaMart, quickrank::learning::forests::ObliviousMart, quickrank::learning::CustomLTR, quickrank::learning::linear::CoordinateAscent, and quickrank::learning::linear::LineSearch.
|
delete |
Avoid inefficient copy assignment.
|
inlinevirtual |
Returns the partial score of a given document, tree by tree.
d | is a pointer to the document to be evaluated |
next_fx_offset | The offset to the next feature in the data representation. |
Reimplemented in quickrank::learning::forests::Rankboost, and quickrank::learning::forests::Mart.
|
inlinevirtual |
Print additional statistics.
At the moment this include only number of comparisons for tree-based algorithms.
Reimplemented in quickrank::learning::forests::Mart.
|
privatepure virtual |
Prints the description of Algorithm, including its parameters.
Implemented in quickrank::learning::forests::Rankboost, quickrank::learning::forests::Mart, quickrank::learning::linear::LineSearch, quickrank::learning::linear::CoordinateAscent, quickrank::learning::CustomLTR, quickrank::learning::forests::ObliviousLambdaMart, and quickrank::learning::forests::ObliviousMart.
|
virtual |
Save the current model to the output_file.
model_filename | The output file name. |
suffix | The suffix used to identify partial model saves. |
|
virtual |
Given and input dateset, the current ranker generates scores for each instance and store the in the scores vector.
dataset | The dataset to be scored. |
scores | The vector where scores are stored. |
|
pure virtual |
Returns the score of a given document.
d | is a pointer to the document to be evaluated |
Implemented in quickrank::learning::forests::Rankboost, quickrank::learning::linear::LineSearch, quickrank::learning::CustomLTR, quickrank::learning::linear::CoordinateAscent, and quickrank::learning::forests::Mart.
|
inlinevirtual |
Update the weights for the ensemble models (only).
Default implementation will do nothing (default for non ensemble models).
Reimplemented in quickrank::learning::forests::Mart, quickrank::learning::linear::LineSearch, and quickrank::learning::linear::CoordinateAscent.
|
friend |
The output stream operator.