#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 18 of file Optimizer.h.
Optimizer::Optimizer | ( | unsigned | Pd, | |
const std::vector< unsigned > & | i2O, | |||
const std::vector< bool > & | positive, | |||
const std::vector< parameter_t > & | start, | |||
unsigned int | nrandom | |||
) |
Optimizer::~Optimizer | ( | ) | [virtual] |
Definition at line 59 of file Optimizer.cpp.
void Optimizer::Get1bests | ( | const Point & | param, | |
std::vector< unsigned > & | bests | |||
) | const |
Given a set of lambdas, get the nbest for each sentence.
Referenced by GetStatScore().
std::vector<statscore_t> Optimizer::GetIncStatScore | ( | const std::vector< unsigned > & | ref, | |
const std::vector< std::vector< std::pair< unsigned, unsigned > > > & | diffs | |||
) | const |
statscore_t Optimizer::GetStatScore | ( | const Point & | param | ) | const |
Definition at line 61 of file Optimizer.cpp.
References Get1bests(), and GetStatScore().
statscore_t Optimizer::GetStatScore | ( | const std::vector< unsigned > & | nbests | ) | const [inline] |
Given a set of nbests, get the Statistical score.
Definition at line 56 of file Optimizer.h.
References m_scorer, and Scorer::score().
Referenced by GetStatScore(), Run(), and RandomOptimizer::TrueRun().
statscore_t 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 88 of file Optimizer.cpp.
References AddThreshold(), CHECK, Point::getdim(), GetIncStatScore(), m_feature_data, m_positive, Point::SetScore(), size(), and verboselevel().
Referenced by RandomDirectionOptimizer::TrueRun(), and SimpleOptimizer::TrueRun().
statscore_t Optimizer::Run | ( | Point & | P | ) | const |
Generic wrapper around TrueRun to check a few things. Non virtual.
Definition at line 330 of file Optimizer.cpp.
References Scorer::getReferenceSize(), Point::GetScore(), GetStatScore(), m_feature_data, m_scorer, Point::SetScore(), TrueRun(), and verboselevel().
void Optimizer::SetFeatureData | ( | FeatureDataHandle | feature_data | ) | [inline] |
Definition at line 31 of file Optimizer.h.
References m_feature_data.
Referenced by main().
void Optimizer::SetScorer | ( | Scorer * | scorer | ) | [inline] |
Definition at line 30 of file Optimizer.h.
References m_scorer.
Referenced by main().
unsigned Optimizer::size | ( | ) | const [inline] |
Definition at line 34 of file Optimizer.h.
References m_feature_data.
Referenced by LineOptimize().
virtual statscore_t Optimizer::TrueRun | ( | Point & | ) | const [pure virtual] |
Main function that performs an optimization.
Implemented in SimpleOptimizer, RandomDirectionOptimizer, and RandomOptimizer.
Referenced by Run().
FeatureDataHandle Optimizer::m_feature_data [protected] |
Definition at line 22 of file Optimizer.h.
Referenced by LineOptimize(), Run(), SetFeatureData(), and size().
unsigned int Optimizer::m_num_random_directions [protected] |
Definition at line 23 of file Optimizer.h.
Referenced by RandomDirectionOptimizer::TrueRun(), and SimpleOptimizer::TrueRun().
const std::vector<bool>& Optimizer::m_positive [protected] |
Scorer* Optimizer::m_scorer [protected] |