From 4223261682388944fe1b1cf31b9d51d88f9ad53b Mon Sep 17 00:00:00 2001
From: Patrick Simianer
Date: Thu, 26 Feb 2015 13:26:37 +0100
Subject: refactoring
---
training/dtrain/pairs.h | 55 -------------------------------------------------
1 file changed, 55 deletions(-)
delete mode 100644 training/dtrain/pairs.h
(limited to 'training/dtrain/pairs.h')
diff --git a/training/dtrain/pairs.h b/training/dtrain/pairs.h
deleted file mode 100644
index dea0dabc..00000000
--- a/training/dtrain/pairs.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef _DTRAIN_PAIRS_H_
-#define _DTRAIN_PAIRS_H_
-
-namespace dtrain
-{
-
-bool
-CmpHypsByScore(ScoredHyp a, ScoredHyp b)
-{
- return a.score > b.score;
-}
-
-/*
- * multipartite ranking
- * sort (descending) by bleu
- * compare top X (hi) to middle Y (med) and low X (lo)
- * cmp middle Y to low X
- */
-inline void
-MakePairs(vector* s,
- vector >& training,
- bool misranked_only,
- float hi_lo)
-{
- unsigned sz = s->size();
- if (sz < 2) return;
- sort(s->begin(), s->end(), CmpHypsByScore);
- unsigned sep = round(sz*hi_lo);
- // hi vs. med vs. low
- unsigned sep_hi = sep;
- if (sz > 4) while (sep_hi < sz && (*s)[sep_hi-1].score == (*s)[sep_hi].score) ++sep_hi;
- else sep_hi = 1;
- for (unsigned i = 0; i < sep_hi; i++) {
- for (unsigned j = sep_hi; j < sz; j++) {
- if (misranked_only && !((*s)[i].model <= (*s)[j].model)) continue;
- if ((*s)[i].score != (*s)[j].score)
- training.push_back(make_pair((*s)[i], (*s)[j]));
- }
- }
- // med vs. low
- unsigned sep_lo = sz-sep;
- while (sep_lo > 0 && (*s)[sep_lo-1].score == (*s)[sep_lo].score) --sep_lo;
- for (unsigned i = sep_hi; i < sep_lo; i++) {
- for (unsigned j = sep_lo; j < sz; j++) {
- if (misranked_only && !((*s)[i].model <= (*s)[j].model)) continue;
- if ((*s)[i].score != (*s)[j].score)
- training.push_back(make_pair((*s)[i], (*s)[j]));
- }
- }
-}
-
-} // namespace
-
-#endif
-
--
cgit v1.2.3