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
commit78a0ee61c2d2d846306b60a8ac862a2d649bcf59 (patch)
tree7fe54c5f63c360a6d43428a57386ac934394dc51 /dtrain/ksampler.h
parentfb42639b433d2fc0c68f300666be1192dc3b4f59 (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;
}
};