summaryrefslogtreecommitdiff
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
commit8fc0fc81d3229065028dfaedf66ab9965bc290b1 (patch)
treeb6a31849f4b67ced0a8d22734f0f27fe7a775173
parentc914b17d0621eb6626a98f86e4d4e118cd589555 (diff)
parent9a464ab9c95f46e0e2614edb5c2a8d181f768619 (diff)
Merge remote-tracking branch 'upstream/master'
-rwxr-xr-xrampion/rampion.pl6
-rw-r--r--rampion/rampion_cccp.cc8
2 files changed, 10 insertions, 4 deletions
diff --git a/rampion/rampion.pl b/rampion/rampion.pl
index fda2bac2..9884f453 100755
--- a/rampion/rampion.pl
+++ b/rampion/rampion.pl
@@ -301,11 +301,15 @@ while (1){
my $score = 0;
my $icc = 0;
my $inweights="$dir/weights.$im1";
+ my $outweights="$dir/weights.$iteration";
$cmd="$MAPINPUT $dir/hgs > $dir/agenda.$im1";
print STDERR "COMMAND:\n$cmd\n";
check_call($cmd);
- die "PLEASE IMPL";
+ $cmd="$MAPPER $refs_comma_sep -m $metric -i $dir/agenda.$im1 -w $inweights > $outweights";
+ check_call($cmd);
+ $lastWeightsFile = $outweights;
$iteration++;
+ `rm hgs/*.gz`;
print STDERR "\n==========\n";
}
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) {