From dfa5e38fa20814c41caf8a94d0f8ad5cbc8f4229 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Thu, 26 Apr 2012 21:19:56 -0400 Subject: working rampion, gimpel&smith (2012) --- rampion/rampion_cccp.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'rampion/rampion_cccp.cc') diff --git a/rampion/rampion_cccp.cc b/rampion/rampion_cccp.cc index 6eb3ccf3..a04da831 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 hyp; @@ -91,7 +92,6 @@ int main(int argc, char** argv) { DocumentScorer ds(metric, conf["reference"].as >()); cerr << "Loaded " << ds.size() << " references for scoring with " << evaluation_metric << endl; double goodsign = 1; - if (metric->IsErrorMetric()) goodsign = -goodsign; double badsign = -goodsign; Hypergraph hg; @@ -121,6 +121,8 @@ int main(int argc, char** argv) { vector& 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, 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 > goals(kis.size()); // f(x_i,y+,h+) SparseVector fear; // f(x,y-,h-) for (unsigned iterp = 1; iterp <= tp; ++iterp) { -- cgit v1.2.3