summaryrefslogtreecommitdiff
path: root/rampion/rampion_cccp.cc
diff options
context:
space:
mode:
authorPatrick Simianer <simianer@cl.uni-heidelberg.de>2012-04-27 16:07:49 +0200
committerPatrick Simianer <simianer@cl.uni-heidelberg.de>2012-04-27 16:07:49 +0200
commit291e511b8f5d130b94d20caa1097deb74072dc99 (patch)
tree6014bd6ab0bc0b43bdf9d03702410047947fe9d6 /rampion/rampion_cccp.cc
parentc7ac569634c07de169a91c9f4d028ecd3899b4df (diff)
parentc5f69888943623e80478b6ba9247acc85758bedf (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'rampion/rampion_cccp.cc')
-rw-r--r--rampion/rampion_cccp.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/rampion/rampion_cccp.cc b/rampion/rampion_cccp.cc
index 6eb3ccf3..7a6f1f0c 100644
--- a/rampion/rampion_cccp.cc
+++ b/rampion/rampion_cccp.cc
@@ -58,6 +58,7 @@ struct HypInfo {
SufficientStats ss;
scorer.Evaluate(hyp, &ss);
g = metric->ComputeScore(ss);
+ if (!metric->IsErrorMetric()) g = 1 - g;
}
vector<WordID> hyp;
@@ -90,8 +91,7 @@ int main(int argc, char** argv) {
EvaluationMetric* metric = EvaluationMetric::Instance(evaluation_metric);
DocumentScorer ds(metric, conf["reference"].as<vector<string> >());
cerr << "Loaded " << ds.size() << " references for scoring with " << evaluation_metric << endl;
- double goodsign = 1;
- if (metric->IsErrorMetric()) goodsign = -goodsign;
+ double goodsign = -1;
double badsign = -goodsign;
Hypergraph hg;
@@ -121,6 +121,8 @@ int main(int argc, char** argv) {
vector<HypInfo>& curkbest = kis.back();
is >> file >> sent_id;
ReadFile rf(file);
+ if (kis.size() % 5 == 0) { cerr << '.'; }
+ if (kis.size() % 200 == 0) { cerr << " [" << kis.size() << "]\n"; }
HypergraphIO::ReadFromJSON(rf.stream(), &hg);
hg.Reweight(weights);
KBest::KBestDerivations<vector<WordID>, ESentenceTraversal> kbest(hg, kbest_size);
@@ -132,8 +134,8 @@ int main(int argc, char** argv) {
curkbest.push_back(HypInfo(d->yield, d->feature_values, *ds[sent_id], metric));
}
}
+ cerr << "\nHypergraphs loaded.\n";
- cerr << "Hypergraphs loaded.\n";
vector<SparseVector<weight_t> > goals(kis.size()); // f(x_i,y+,h+)
SparseVector<weight_t> fear; // f(x,y-,h-)
for (unsigned iterp = 1; iterp <= tp; ++iterp) {