31 namespace optimization {
54 virtual std::string
name()
const = 0;
65 virtual void optimize(std::shared_ptr<learning::LTR_Algorithm> algo,
66 std::shared_ptr<data::Dataset> training_dataset,
67 std::shared_ptr<data::Dataset> validation_dataset,
68 std::shared_ptr<metric::ir::Metric> metric,
70 const std::string model_filename) = 0;
76 virtual void save(std::string model_filename,
int suffix = -1)
const;
87 std::string model_filename);
93 auto i_item = std::find(optimizationAlgorithmNames.cbegin(),
94 optimizationAlgorithmNames.cend(),
96 if (i_item != optimizationAlgorithmNames.cend()) {
102 throw std::invalid_argument(
"pruning method " + name +
" is not valid");
106 return optimizationAlgorithmNames[
static_cast<int>(optAlgo)];
117 virtual std::ostream &
put(std::ostream &os)
const = 0;
Definition: dataset.cc:28
Definition: optimization.h:33
virtual bool is_pre_learning() const =0
static std::shared_ptr< Optimization > load_model_from_file(std::string model_filename)
Load a model from a given XML file.
Definition: optimization.cc:49
virtual ~Optimization()=default
virtual bool need_partial_score_dataset() const =0
virtual void optimize(std::shared_ptr< learning::LTR_Algorithm > algo, 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 optimization process.
static const std::vector< std::string > optimizationAlgorithmNames
Definition: optimization.h:90
friend std::ostream & operator<<(std::ostream &os, const Optimization &a)
The output stream operator.
Definition: optimization.h:112
virtual pugi::xml_document * get_xml_model() const =0
Return the xml model representing the current object.
OptimizationAlgorithm
Definition: optimization.h:37
virtual std::string name() const =0
Returns the name of the optimizer.
static std::string getPruningMethod(OptimizationAlgorithm optAlgo)
Definition: optimization.h:105
virtual void save(std::string model_filename, int suffix=-1) const
Save the current model to the output_file.
Definition: optimization.cc:36
Optimization & operator=(const Optimization &)=delete
Avoid inefficient copy assignment.
Optimization()
Definition: optimization.h:41
virtual std::ostream & put(std::ostream &os) const =0
Prints the description of Algorithm, including its parameters.
static OptimizationAlgorithm getOptimizationAlgorithm(std::string name)
Definition: optimization.h:92