44 Mart(
size_t ntrees,
double shrinkage,
size_t nthresholds,
45 size_t ntreeleaves,
size_t minleafsupport,
46 size_t valid_iterations)
56 Mart(
const pugi::xml_document &model);
62 virtual void learn(std::shared_ptr<data::Dataset> training_dataset,
63 std::shared_ptr<data::Dataset> validation_dataset,
64 std::shared_ptr<metric::ir::Metric> training_metric,
66 const std::string output_basename);
83 std::cerr <<
"Zero alberi nell'ensemble..." << std::endl;
95 virtual std::string
name()
const {
99 virtual bool update_weights(std::shared_ptr<std::vector<double>> weights);
101 virtual std::shared_ptr<std::vector<double>>
get_weights()
const {
110 virtual void init(std::shared_ptr<data::VerticalDataset> training_dataset);
113 virtual void clear(
size_t num_features);
120 std::shared_ptr<data::VerticalDataset> training_dataset,
127 std::shared_ptr<data::VerticalDataset> training_dataset);
170 virtual std::ostream &
put(std::ostream &os)
const;
size_t sortedsize_
Definition: mart.h:160
size_t ntrees_
Definition: mart.h:151
Definition: dataset.cc:28
virtual std::string name() const
Returns the name of the ranker.
Definition: mart.h:95
virtual std::shared_ptr< std::vector< double > > get_weights() const
Return the weights for the ensemble models (only).
Definition: mart.h:101
virtual pugi::xml_document * get_xml_model() const
Return the xml model representing the current object.
Definition: mart.cc:355
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.
Definition: mart.cc:309
This class implements the basic functionalities of an IR evaluation metric.
Definition: metric.h:43
RTRootHistogram * hist_
Definition: mart.h:161
virtual void print_additional_stats(void) const
Print additional statistics.
Definition: mart.cc:378
size_t get_size() const
Definition: ensemble.h:36
size_t validation_bestmodel_
Definition: mart.h:147
friend std::ostream & operator<<(std::ostream &os, const Mart &a)
The output stream operator.
Definition: mart.h:165
Definition: ltr_algorithm.h:33
float Feature
data type for instance predicted label
Definition: types.h:31
double shrinkage_
Definition: mart.h:152
double * pseudoresponses_
Definition: mart.h:148
virtual void init(std::shared_ptr< data::VerticalDataset > training_dataset)
Prepares private data structures before training takes place.
Definition: mart.cc:93
quickrank::Score * scores_on_validation_
Definition: mart.h:146
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.
Definition: mart.cc:176
float ** thresholds_
Definition: mart.h:143
static const std::string NAME_
Definition: mart.h:105
virtual ~Mart()
Definition: mart.h:58
size_t nthresholds_
Definition: mart.h:153
virtual void update_modelscores(std::shared_ptr< data::Dataset > dataset, Score *scores, RegressionTree *tree)
Updates scores with the last learnt regression tree.
Definition: mart.cc:323
size_t * thresholds_size_
Definition: mart.h:144
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.
Definition: mart.h:44
Definition: ensemble.h:28
Definition: rtnode_histogram.h:53
size_t valid_iterations_
Definition: mart.h:157
double * scores_on_training_
Definition: mart.h:145
double Score
data type for instance truth label
Definition: types.h:30
virtual std::shared_ptr< std::vector< quickrank::Score > > partial_scores_instance(const quickrank::Feature *d, const size_t offset=1) const
Definition: ensemble.cc:61
virtual void clear(size_t num_features)
De-allocates private data structure after training has taken place.
Definition: mart.cc:157
virtual Score score_document(const Feature *d) const
Returns the score by the current ranker.
Definition: mart.h:71
size_t nleaves_
Definition: mart.h:154
virtual bool update_weights(std::shared_ptr< std::vector< double >> weights)
Update the weights for the ensemble models (only).
Definition: mart.cc:374
virtual quickrank::Score score_instance(const quickrank::Feature *d, const size_t offset=1) const
Definition: ensemble.cc:51
virtual std::ostream & put(std::ostream &os) const
Prints the description of Algorithm, including its parameters.
Definition: mart.cc:76
size_t minleafsupport_
Definition: mart.h:155
virtual void compute_pseudoresponses(std::shared_ptr< data::VerticalDataset > training_dataset, metric::ir::Metric *metric)
Computes pseudo responses.
Definition: mart.cc:300
virtual std::shared_ptr< std::vector< Score > > partial_scores_document(const Feature *d) const
Returns the partial scores of a given document, tree.
Definition: mart.h:79
Ensemble ensemble_model_
Definition: mart.h:149
virtual std::shared_ptr< std::vector< double > > get_weights() const
Definition: ensemble.cc:104
size_t ** sortedsid_
Definition: mart.h:159