summaryrefslogtreecommitdiff
path: root/dtrain/ksampler.h
diff options
context:
space:
mode:
authorPatrick Simianer <simianer@cl.uni-heidelberg.de>2012-05-15 00:44:03 +0200
committerPatrick Simianer <simianer@cl.uni-heidelberg.de>2012-05-15 00:44:03 +0200
commit37050e861de2b216d3a28f79e111b674c5d142ac (patch)
treef830d51ca55af1d1a67f2e7bad687cc46480317b /dtrain/ksampler.h
parent7c344de97edac0aa2a6a90c2de9bcf60f15ac000 (diff)
loss margin cfg, XYX improved, smooth bleu variant
Diffstat (limited to 'dtrain/ksampler.h')
-rw-r--r--dtrain/ksampler.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/dtrain/ksampler.h b/dtrain/ksampler.h
index f52fb649..bc2f56cd 100644
--- a/dtrain/ksampler.h
+++ b/dtrain/ksampler.h
@@ -8,6 +8,11 @@
namespace dtrain
{
+bool
+cmp_hyp_by_model_d(ScoredHyp a, ScoredHyp b)
+{
+ return a.model > b.model;
+}
struct KSampler : public HypSampler
{
@@ -44,6 +49,8 @@ struct KSampler : public HypSampler
sz_++;
f_count_ += h.f.size();
}
+ sort(s_.begin(), s_.end(), cmp_hyp_by_model_d);
+ for (unsigned i = 0; i < s_.size(); i++) s_[i].rank = i;
}
};