diff options
author | jfouet <jfouet@1f5c12ca-751b-0410-a591-d2e778427230> | 2008-05-15 23:09:01 +0400 |
---|---|---|
committer | jfouet <jfouet@1f5c12ca-751b-0410-a591-d2e778427230> | 2008-05-15 23:09:01 +0400 |
commit | b231ffc8b1d9b81e5f5a6188327b157763344349 (patch) | |
tree | 8aa46ba4c84333575e2f03c4d79593f2f6f32103 /mert/Optimizer.h | |
parent | ad2ee87603dde378c6c275ee29c7b5402396ed6c (diff) |
add Types.h to unify the typedefs
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1713 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'mert/Optimizer.h')
-rw-r--r-- | mert/Optimizer.h | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/mert/Optimizer.h b/mert/Optimizer.h index c3000e52c..d5c066bb6 100644 --- a/mert/Optimizer.h +++ b/mert/Optimizer.h @@ -6,7 +6,7 @@ #include "FeatureArray.h" #include "Scorer.h" #include "Point.h" - +#include "Types.h" typedef float featurescore; @@ -20,36 +20,37 @@ class Optimizer{ Scorer * scorer; //no accessor for them only child can use them FeatureData * FData;//no accessor for them only child can use them public: - Optimizer(unsigned Pd,vector<unsigned> i2O,vector<lambda> start); + Optimizer(unsigned Pd,vector<unsigned> i2O,parameters_t start); void SetScorer(Scorer *S); void SetFData(FeatureData *F); virtual ~Optimizer(); unsigned size()const{return (FData?FData->size():0);} /**Generic wrapper around TrueRun to check a few things. Non virtual*/ - statscore Run(Point&)const; + statscore_t Run(Point&)const; /**main function that perform an optimization*/ - virtual statscore TrueRun(Point&)const=0; + virtual statscore_t TrueRun(Point&)const=0; /**given a set of lambdas, get the nbest for each sentence*/ void Get1bests(const Point& param,vector<unsigned>& bests)const; /**given a set of nbests, get the Statistical score*/ - statscore GetStatScore(const vector<unsigned>& nbests)const{scorer->score(nbests);}; + statscore_t GetStatScore(const vector<unsigned>& nbests)const{scorer->score(nbests);}; /**given a set of lambdas, get the total statistical score*/ - statscore GetStatScore(const Point& param)const; - vector<statscore> GetIncStatScore(vector<unsigned> ref,vector<vector <pair<unsigned,unsigned> > >)const; - statscore 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 + statscore_t GetStatScore(const Point& param)const; + vector<statscore_t > GetIncStatScore(vector<unsigned> ref,vector<vector <pair<unsigned,unsigned> > >)const; + statscore_t 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 }; /**default basic optimizer*/ class SimpleOptimizer: public Optimizer{ -private: float eps; +private: +static float eps; public: - SimpleOptimizer(unsigned dim,vector<unsigned> i2O,vector<lambda> start):Optimizer(dim,i2O,start),eps(0.001){}; - virtual statscore TrueRun(Point&)const; + SimpleOptimizer(unsigned dim,vector<unsigned> i2O,parameters_t start):Optimizer(dim,i2O,start){}; + virtual statscore_t TrueRun(Point&)const; }; -Optimizer *BuildOptimizer(unsigned dim,vector<unsigned>tooptimize,vector<lambda>start,string type); +Optimizer *BuildOptimizer(unsigned dim,vector<unsigned>tooptimize,parameters_t start,string type); #endif |