#include <Optimizer.h>
Public Member Functions | |
Optimizer (unsigned Pd, const std::vector< unsigned > &i2O, const std::vector< bool > &positive, const std::vector< parameter_t > &start, unsigned int nrandom) | |
void | SetScorer (Scorer *scorer) |
void | SetFeatureData (FeatureDataHandle feature_data) |
virtual | ~Optimizer () |
unsigned | size () const |
statscore_t | Run (Point &) const |
virtual statscore_t | TrueRun (Point &) const =0 |
void | Get1bests (const Point ¶m, std::vector< unsigned > &bests) const |
statscore_t | GetStatScore (const std::vector< unsigned > &nbests) const |
statscore_t | GetStatScore (const Point ¶m) const |
std::vector< statscore_t > | GetIncStatScore (const std::vector< unsigned > &ref, const std::vector< std::vector< std::pair< unsigned, unsigned > > > &diffs) const |
statscore_t | LineOptimize (const Point &start, const Point &direction, Point &best) const |
Protected Attributes | |
Scorer * | m_scorer |
FeatureDataHandle | m_feature_data |
unsigned int | m_num_random_directions |
const std::vector< bool > & | m_positive |
Definition at line 22 of file Optimizer.h.
MosesTuning::Optimizer::Optimizer | ( | unsigned | Pd, | |
const std::vector< unsigned > & | i2O, | |||
const std::vector< bool > & | positive, | |||
const std::vector< parameter_t > & | start, | |||
unsigned int | nrandom | |||
) |
MosesTuning::Optimizer::~Optimizer | ( | ) | [virtual] |
Definition at line 64 of file Optimizer.cpp.
void MosesTuning::Optimizer::Get1bests | ( | const Point & | param, | |
std::vector< unsigned > & | bests | |||
) | const |
Given a set of lambdas, get the nbest for each sentence.
std::vector<statscore_t> MosesTuning::Optimizer::GetIncStatScore | ( | const std::vector< unsigned > & | ref, | |
const std::vector< std::vector< std::pair< unsigned, unsigned > > > & | diffs | |||
) | const |
statscore_t MosesTuning::Optimizer::GetStatScore | ( | const Point & | param | ) | const |
Definition at line 66 of file Optimizer.cpp.
statscore_t MosesTuning::Optimizer::GetStatScore | ( | const std::vector< unsigned > & | nbests | ) | const [inline] |
Given a set of nbests, get the Statistical score.
Definition at line 64 of file Optimizer.h.
References m_scorer, and MosesTuning::Scorer::score().
Referenced by MosesTuning::RandomOptimizer::TrueRun().
statscore_t MosesTuning::Optimizer::LineOptimize | ( | const Point & | start, | |
const Point & | direction, | |||
Point & | best | |||
) | const |
Get the optimal Lambda and the best score in a particular direction from a given Point.
Definition at line 93 of file Optimizer.cpp.
References MosesTuning::AddThreshold(), MosesTuning::Point::getdim(), k, m, MosesTuning::Point::SetScore(), UTIL_THROW_IF, and MosesTuning::verboselevel().
Referenced by MosesTuning::RandomDirectionOptimizer::TrueRun(), and MosesTuning::SimpleOptimizer::TrueRun().
statscore_t MosesTuning::Optimizer::Run | ( | Point & | P | ) | const |
Generic wrapper around TrueRun to check a few things. Non virtual.
Definition at line 344 of file Optimizer.cpp.
References MosesTuning::Point::GetScore(), MosesTuning::Point::SetScore(), and MosesTuning::verboselevel().
void MosesTuning::Optimizer::SetFeatureData | ( | FeatureDataHandle | feature_data | ) | [inline] |
Definition at line 37 of file Optimizer.h.
References m_feature_data.
Referenced by main().
void MosesTuning::Optimizer::SetScorer | ( | Scorer * | scorer | ) | [inline] |
Definition at line 34 of file Optimizer.h.
References m_scorer.
Referenced by main().
unsigned MosesTuning::Optimizer::size | ( | ) | const [inline] |
virtual statscore_t MosesTuning::Optimizer::TrueRun | ( | Point & | ) | const [pure virtual] |
Main function that performs an optimization.
Implemented in MosesTuning::SimpleOptimizer, MosesTuning::RandomDirectionOptimizer, and MosesTuning::RandomOptimizer.
unsigned int MosesTuning::Optimizer::m_num_random_directions [protected] |
Definition at line 27 of file Optimizer.h.
Referenced by MosesTuning::RandomDirectionOptimizer::TrueRun(), and MosesTuning::SimpleOptimizer::TrueRun().
const std::vector<bool>& MosesTuning::Optimizer::m_positive [protected] |
Definition at line 29 of file Optimizer.h.
Scorer* MosesTuning::Optimizer::m_scorer [protected] |