From 9cc64edcdbeb463b27c3ef37c892cc404c5cf8b4 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Fri, 16 Oct 2015 12:37:08 +0200 Subject: dtrain: fixes --- training/dtrain/dtrain.cc | 2 +- training/dtrain/dtrain.h | 2 +- training/dtrain/sample.h | 2 +- training/dtrain/update.h | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'training/dtrain') diff --git a/training/dtrain/dtrain.cc b/training/dtrain/dtrain.cc index e563f541..ddd27211 100644 --- a/training/dtrain/dtrain.cc +++ b/training/dtrain/dtrain.cc @@ -112,7 +112,7 @@ main(int argc, char** argv) cerr << setw(25) << "learning rate " << eta << endl; cerr << setw(25) << "margin " << margin << endl; if (!structured) { - cerr << setw(25) << "cut " << cut << endl; + cerr << setw(25) << "cut " << round(cut*100) << "%" << endl; cerr << setw(25) << "adjust " << adjust_cut << endl; } else { cerr << setw(25) << "struct. obj " << structured << endl; diff --git a/training/dtrain/dtrain.h b/training/dtrain/dtrain.h index 18a7dbdc..b07edfdf 100644 --- a/training/dtrain/dtrain.h +++ b/training/dtrain/dtrain.h @@ -64,7 +64,7 @@ dtrain_init(int argc, pair sampling, 0 to use all pairs TODO") ("adjust,A", po::bool_switch()->default_value(false), "adjust cut for optimal pos. in k-best to cut") - ("score,s", po::value()->default_value("chiang"), + ("score,s", po::value()->default_value("nakov"), "per-sentence BLEU (approx.)") ("nakov_fix", po::value()->default_value(1.0), "add to reference length [see score.h]") diff --git a/training/dtrain/sample.h b/training/dtrain/sample.h index bccc29b7..860904fd 100644 --- a/training/dtrain/sample.h +++ b/training/dtrain/sample.h @@ -115,7 +115,7 @@ struct KSampler : public HypSampler effective_size++; feature_count += sample.back().f.size(); } - sort(sample.begin(), sample.end(), [](Hyp& first, Hyp& second) { + sort(sample.begin(), sample.end(), [](Hyp first, Hyp second) { return first.model > second.model; }); for (unsigned i=0; i* sample, size_t up = 0; size_t sz = sample->size(); if (sz < 2) return 0; - sort(sample->begin(), sample->end(), [](Hyp& first, Hyp& second) + sort(sample->begin(), sample->end(), [](Hyp first, Hyp second) { return first.gold > second.gold; }); @@ -95,7 +95,7 @@ updates_all(vector* sample, { size_t up = 0; size_t sz = sample->size(); - sort(sample->begin(), sample->end(), [](Hyp& first, Hyp& second) + sort(sample->begin(), sample->end(), [](Hyp first, Hyp second) { return first.gold > second.gold; }); @@ -129,13 +129,13 @@ update_structured(vector* sample, ostream& os=cout) { // hope - sort(sample->begin(), sample->end(), [](Hyp& first, Hyp& second) + sort(sample->begin(), sample->end(), [](Hyp first, Hyp second) { return (first.model+first.gold) > (second.model+second.gold); }); Hyp hope = (*sample)[0]; // fear - sort(sample->begin(), sample->end(), [](Hyp& first, Hyp& second) + sort(sample->begin(), sample->end(), [](Hyp first, Hyp second) { return (first.model-first.gold) > (second.model-second.gold); }); -- cgit v1.2.3