41 LineSearch(
unsigned int num_points,
double window_size,
42 double reduction_factor,
unsigned int max_iterations,
43 unsigned int max_failed_vali,
bool adaptive,
44 unsigned int last_only = 0);
51 virtual std::string
name()
const {
76 virtual void learn(std::shared_ptr<data::Dataset> training_dataset,
77 std::shared_ptr<data::Dataset> validation_dataset,
78 std::shared_ptr<metric::ir::Metric> metric,
80 const std::string model_filename);
86 virtual std::shared_ptr<std::vector<double>>
get_weights()
const {
88 return std::shared_ptr<std::vector<double>>(
92 virtual bool update_weights(std::shared_ptr<std::vector<double>> weights);
114 virtual std::ostream &
put(std::ostream &os)
const;
117 unsigned int num_samples,
118 unsigned int num_features,
121 Score *training_score,
122 unsigned int feature_exclude);
124 virtual void score(
Feature *dataset,
unsigned int num_samples,
125 unsigned int num_features,
double *weights,
Score *scores);
virtual pugi::xml_document * get_xml_model() const
Return the xml model representing the current object.
Definition: line_search.cc:389
static const std::string NAME_
Definition: line_search.h:67
unsigned int train_only_last_
Definition: line_search.h:104
Definition: dataset.cc:28
unsigned int max_iterations_
Definition: line_search.h:101
bool adaptive_
Definition: line_search.h:103
double window_size_
Definition: line_search.h:99
std::vector< double > best_weights_
Definition: line_search.h:106
unsigned int get_last_only() const
Definition: line_search.h:55
Definition: ltr_algorithm.h:33
virtual std::string name() const
Returns the name of the ranker.
Definition: line_search.h:51
unsigned int num_points_
Definition: line_search.h:98
float Feature
data type for instance predicted label
Definition: types.h:31
void reset_weights()
Definition: line_search.h:63
virtual void score(Feature *dataset, unsigned int num_samples, unsigned int num_features, double *weights, Score *scores)
Definition: line_search.cc:443
This implements the Line Search algorithm.
Definition: line_search.h:37
virtual ~LineSearch()
Definition: line_search.cc:101
virtual bool update_weights(std::shared_ptr< std::vector< double >> weights)
Update the weights for the ensemble models (only).
Definition: line_search.cc:374
double Score
data type for instance truth label
Definition: types.h:30
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)
Executes the learning process.
Definition: line_search.cc:117
virtual std::shared_ptr< std::vector< double > > get_weights() const
Returns the learned weights.
Definition: line_search.h:86
unsigned int max_failed_vali_
Definition: line_search.h:102
virtual Score score_document(const Feature *d) const
Returns the score of a given document.
Definition: line_search.cc:366
double reduction_factor_
Definition: line_search.h:100
virtual std::ostream & put(std::ostream &os) const
Prints the description of Algorithm, including its parameters.
Definition: line_search.cc:104
friend std::ostream & operator<<(std::ostream &os, const LineSearch &a)
The output stream operator.
Definition: line_search.h:109
virtual void preCompute(Feature *training_dataset, unsigned int num_samples, unsigned int num_features, Score *pre_sum, double *weights, Score *training_score, unsigned int feature_exclude)
Definition: line_search.cc:424
LineSearch(unsigned int num_points, double window_size, double reduction_factor, unsigned int max_iterations, unsigned int max_failed_vali, bool adaptive, unsigned int last_only=0)
Definition: line_search.cc:37
void set_last_only(unsigned int last_only)
Definition: line_search.h:59