diff --git a/mert/evaluator.cpp b/mert/evaluator.cpp index 835fed017..93c8455e1 100644 --- a/mert/evaluator.cpp +++ b/mert/evaluator.cpp @@ -25,6 +25,8 @@ string int2string(int n); bool moreFiles = false; bool moreScorers = false; +float alpha = 0.05; + void usage() { cerr<<"usage: evaluator [options] --reference ref1[,ref2[,ref3...]] --candidate cand1[,cand2[,cand3...]] "<score(candidates); scores.push_back(score); delete scoredata; - } + } float avg = average(scores); - float dev = stdDeviation(scores, avg); + + sort(scores.begin(), scores.end()); + + int lbIdx = scores.size() * (alpha / 2); + int rbIdx = scores.size() * (1 - alpha / 2); + + float lb = scores[lbIdx]; + float rb = scores[rbIdx]; if (moreFiles) cout << candFile << "\t"; if (moreScorers) cout << scorer->getName() << "\t"; cout.setf(ios::fixed,ios::floatfield); cout.precision(4); - cout << avg << " [+-" << dev << "]"<< endl; + cout << avg << "\t[" << lb << "," << rb << "]"<< endl; } else { @@ -234,12 +243,3 @@ float average(const vector& list) return sum / list.size(); } - -float stdDeviation(const vector& list, float avg) -{ - vector tmp; - for (vector::const_iterator it = list.begin(); it != list.end(); ++it) - tmp.push_back(pow(*it - avg, 2)); - - return sqrt(average(tmp)); -}