QuickRank
v2.0
QuickRank: A C++ suite of Learning to Rank algorithms
|
#include <obliviouslambdamart.h>
Public Member Functions | |
ObliviousLambdaMart (size_t ntrees, double shrinkage, size_t nthresholds, size_t treedepth, size_t minleafsupport, size_t esr) | |
Initializes a new ObliviousLambdaMart instance with the given learning parameters. More... | |
ObliviousLambdaMart (const pugi::xml_document &model) | |
virtual | ~ObliviousLambdaMart () |
virtual std::string | name () const |
Returns the name of the ranker. More... | |
virtual pugi::xml_document * | get_xml_model () const |
Return the xml model representing the current object. More... | |
Public Member Functions inherited from quickrank::learning::forests::LambdaMart | |
LambdaMart (size_t ntrees, double shrinkage, size_t nthresholds, size_t ntreeleaves, size_t minleafsupport, size_t esr) | |
Initializes a new LambdaMart instance with the given learning parameters. More... | |
LambdaMart (const pugi::xml_document &model) | |
Generates a LTR_Algorithm instance from a previously saved XML model. More... | |
virtual | ~LambdaMart () |
Public Member Functions inherited from quickrank::learning::forests::Mart | |
Mart (size_t ntrees, double shrinkage, size_t nthresholds, size_t ntreeleaves, size_t minleafsupport, size_t valid_iterations) | |
Initializes a new Mart instance with the given learning parameters. More... | |
Mart (const pugi::xml_document &model) | |
Generates a LTR_Algorithm instance from a previously saved XML model. More... | |
virtual | ~Mart () |
virtual void | learn (std::shared_ptr< data::Dataset > training_dataset, std::shared_ptr< data::Dataset > validation_dataset, std::shared_ptr< metric::ir::Metric > training_metric, size_t partial_save, const std::string output_basename) |
Start the learning process. More... | |
virtual Score | score_document (const Feature *d) const |
Returns the score by the current ranker. More... | |
virtual std::shared_ptr< std::vector< Score > > | partial_scores_document (const Feature *d) const |
Returns the partial scores of a given document, tree. 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... | |
Public Member Functions inherited from quickrank::learning::LTR_Algorithm | |
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 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 void | save (std::string model_filename, int suffix=-1) const |
Save the current model to the output_file. More... | |
Static Public Attributes | |
static const std::string | NAME_ = "OBVLAMBDAMART" |
Static Public Attributes inherited from quickrank::learning::forests::LambdaMart | |
static const std::string | NAME_ = "LAMBDAMART" |
Static Public Attributes inherited from quickrank::learning::forests::Mart | |
static const std::string | NAME_ = "MART" |
Protected Member Functions | |
virtual std::unique_ptr< RegressionTree > | fit_regressor_on_gradient (std::shared_ptr< data::VerticalDataset > training_dataset) |
Fits a regression tree on the gradient given by the pseudo residuals. More... | |
Protected Member Functions inherited from quickrank::learning::forests::LambdaMart | |
virtual void | init (std::shared_ptr< data::VerticalDataset > training_dataset) |
Prepares private data structurs befor training takes place. More... | |
virtual void | clear (size_t num_features) |
De-allocates private data structure after training has taken place. More... | |
virtual void | compute_pseudoresponses (std::shared_ptr< data::VerticalDataset > training_dataset, metric::ir::Metric *metric) |
Computes pseudo responses. More... | |
Protected Member Functions inherited from quickrank::learning::forests::Mart | |
virtual void | update_modelscores (std::shared_ptr< data::Dataset > dataset, Score *scores, RegressionTree *tree) |
Updates scores with the last learnt regression tree. More... | |
virtual void | update_modelscores (std::shared_ptr< data::VerticalDataset > dataset, Score *scores, RegressionTree *tree) |
Protected Attributes | |
size_t | treedepth_ |
Protected Attributes inherited from quickrank::learning::forests::LambdaMart | |
double * | instance_weights_ = NULL |
Protected Attributes inherited from quickrank::learning::forests::Mart | |
float ** | thresholds_ = NULL |
size_t * | thresholds_size_ = NULL |
double * | scores_on_training_ = NULL |
quickrank::Score * | scores_on_validation_ = NULL |
size_t | validation_bestmodel_ = 0 |
double * | pseudoresponses_ = NULL |
Ensemble | ensemble_model_ |
size_t | ntrees_ |
double | shrinkage_ |
size_t | nthresholds_ |
size_t | nleaves_ |
size_t | minleafsupport_ |
size_t | valid_iterations_ |
size_t ** | sortedsid_ = NULL |
size_t | sortedsize_ = 0 |
RTRootHistogram * | hist_ = NULL |
Private Member Functions | |
virtual std::ostream & | put (std::ostream &os) const |
Prints the description of Algorithm, including its parameters. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const ObliviousLambdaMart &a) |
The output stream operator. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from quickrank::learning::LTR_Algorithm | |
static std::shared_ptr< LTR_Algorithm > | load_model_from_file (std::string model_filename) |
Load a model from a given XML file. More... | |
|
inline |
Initializes a new ObliviousLambdaMart instance with the given learning parameters.
ntrees | Maximum number of trees. |
shrinkage | Learning rate. |
nthresholds | Number of bins in discretization. 0 means no discretization. |
treedepth | Maximum depth of each tree. |
minleafsupport | Minimum number of instances in each leaf. |
esr | Early stopping if no improvement after iterations on the validation set. |
quickrank::learning::forests::ObliviousLambdaMart::ObliviousLambdaMart | ( | const pugi::xml_document & | model | ) |
|
inlinevirtual |
|
protectedvirtual |
Fits a regression tree on the gradient given by the pseudo residuals.
training_dataset | The dataset used for training |
Reimplemented from quickrank::learning::forests::LambdaMart.
|
virtual |
Return the xml model representing the current object.
Reimplemented from quickrank::learning::forests::Mart.
|
inlinevirtual |
Returns the name of the ranker.
Reimplemented from quickrank::learning::forests::LambdaMart.
|
privatevirtual |
Prints the description of Algorithm, including its parameters.
Reimplemented from quickrank::learning::forests::Mart.
|
friend |
The output stream operator.
|
static |
|
protected |