28 #include "pugixml/src/pugixml.hpp" 51 virtual std::string
name()
const = 0;
60 virtual void learn(std::shared_ptr<data::Dataset> training_dataset,
61 std::shared_ptr<data::Dataset> validation_dataset,
62 std::shared_ptr<metric::ir::Metric> metric,
64 const std::string model_filename) = 0;
73 virtual void score_dataset(std::shared_ptr<data::Dataset> dataset,
94 virtual void save(std::string model_filename,
int suffix = -1)
const;
100 std::string model_filename);
121 virtual std::shared_ptr<std::vector<double>>
get_weights()
const {
133 virtual std::ostream &
put(std::ostream &os)
const = 0;
Definition: dataset.cc:28
friend std::ostream & operator<<(std::ostream &os, const LTR_Algorithm &a)
The output stream operator.
Definition: ltr_algorithm.h:128
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 s...
Definition: ltr_algorithm.cc:42
LTR_Algorithm()
Definition: ltr_algorithm.h:36
virtual Score score_document(const Feature *d) const =0
Returns the score of a given document.
virtual void save(std::string model_filename, int suffix=-1) const
Save the current model to the output_file.
Definition: ltr_algorithm.cc:51
Definition: ltr_algorithm.h:33
virtual void print_additional_stats(void) const
Print additional statistics.
Definition: ltr_algorithm.h:108
virtual std::shared_ptr< std::vector< double > > get_weights() const
Return the weights for the ensemble models (only).
Definition: ltr_algorithm.h:121
float Feature
data type for instance predicted label
Definition: types.h:31
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.
double Score
data type for instance truth label
Definition: types.h:30
static std::shared_ptr< LTR_Algorithm > load_model_from_file(std::string model_filename)
Load a model from a given XML file.
Definition: ltr_algorithm.cc:64
virtual std::string name() const =0
Returns the name of the ranker.
virtual pugi::xml_document * get_xml_model() const =0
Return the xml model representing the current object.
LTR_Algorithm & operator=(const LTR_Algorithm &)=delete
Avoid inefficient copy assignment.
virtual std::ostream & put(std::ostream &os) const =0
Prints the description of Algorithm, including its parameters.
virtual ~LTR_Algorithm()
Definition: ltr_algorithm.h:42
virtual bool update_weights(std::shared_ptr< std::vector< double >> weights)
Update the weights for the ensemble models (only).
Definition: ltr_algorithm.h:114
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.
Definition: ltr_algorithm.h:85