various small fixes

git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1702 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
jfouet 2008-05-15 14:17:34 +00:00
parent 777ea5f754
commit b0ee845d7e
4 changed files with 11 additions and 6 deletions

View File

@ -36,8 +36,7 @@ class Optimizer{
statscore 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;
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
};

View File

@ -11,7 +11,7 @@ unsigned Point::dim=0;
map<unsigned,lambda> Point::fixedweights;
unsigned Point::pdim=0;
unsigned Point::ncall=0;
void Point::Randomize(const vector<lambda>& min,const vector<lambda>& max){
for (int i=0; i<size(); i++)
@ -30,6 +30,7 @@ void Point::Normalize(){
}
double Point::operator*(const FeatureStats& F)const{
ncall++;//to track performance
double prod=0.0;
if(OptimizeAll())
for (unsigned i=0; i<size(); i++)

View File

@ -21,6 +21,7 @@ class Point:public vector<lambda>{
static map<unsigned,lambda> fixedweights;
/**total size of the parameter space; we have pdim=FixedWeight.size()+optinidices.size()*/
static unsigned pdim;
static unsigned ncall;
public:
static unsigned getdim(){return dim;}
static unsigned getpdim(){return pdim;}

View File

@ -1,5 +1,5 @@
/**
\description The is the main for the new versionh of the mert algorithm develloppped during the 2nd MT marathon
\description The is the main for the new version of the mert algorithm develloppped during the 2nd MT marathon
*/
#include <limits>
@ -23,7 +23,11 @@ float min_interval = 1e-3;
using namespace std;
void usage(void) {
cerr<<"usage: mert -d <dimensions> \n[-n] retry ntimes\n";
cerr<<"usage: mert -d <dimensions>"<<endl;
cerr<<"[-n retry ntimes]"<<endl;
cerr<<"[-o indexes to optimize]"<<endl;
cerr<<"[-t optimizer]"<<endl;
cerr<<"[-s scorer]"<<endl;
exit(1);
}
@ -75,7 +79,7 @@ int main (int argc, char **argv) {
usage();
start.resize(dim);
float score;
float best=numeric_limits<float>::max();
float best=numeric_limits<float>::min();
float mean=0;
float var=0;
Point bestP;