Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatous Machacek <machacekmatous@gmail.com>2012-01-25 00:25:15 +0400
committerMatous Machacek <machacekmatous@gmail.com>2012-01-25 00:25:15 +0400
commit5254e7917b1e2e4d86fab27100f3cb6bc9c35c06 (patch)
tree17ca49ca1cab3acbf9c32f6fd9680ed78cd9b1ac /mert/evaluator.cpp
parentc8cde151374820911f0212f1021a276a990560ee (diff)
mert/evaluator should now compute confidence interval correctly
Diffstat (limited to 'mert/evaluator.cpp')
-rw-r--r--mert/evaluator.cpp24
1 files changed, 12 insertions, 12 deletions
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...]] "<<endl;
@@ -184,17 +186,24 @@ void evaluate(const string& candFile)
float score = scorer->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<float>& list)
return sum / list.size();
}
-
-float stdDeviation(const vector<float>& list, float avg)
-{
- vector<float> tmp;
- for (vector<float>::const_iterator it = list.begin(); it != list.end(); ++it)
- tmp.push_back(pow(*it - avg, 2));
-
- return sqrt(average(tmp));
-}