Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mira
diff options
context:
space:
mode:
authorEva Hasler <ehasler@saxnot.inf.ed.ac.uk>2012-04-30 09:07:39 +0400
committerEva Hasler <ehasler@saxnot.inf.ed.ac.uk>2012-04-30 09:07:39 +0400
commit77444b3e9162bdfc8c168f69abe3c778e4133b0b (patch)
tree923abef5422032dffe2cfe9801c0f37dd563d4ea /mira
parent3eb1e0d765ec9cee59c6ed3fe76fd2435f6562e0 (diff)
add sanity check for sampled hypotheses
Diffstat (limited to 'mira')
-rw-r--r--mira/Main.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/mira/Main.cpp b/mira/Main.cpp
index e406a2b00..f10e607ca 100644
--- a/mira/Main.cpp
+++ b/mira/Main.cpp
@@ -1101,16 +1101,20 @@ int main(int argc, char** argv) {
}
cerr << "Rank " << rank << ", epoch " << epoch << ", Best: " << bleuBest*current_input_length << " (" << indexBest << ")" << endl;
cerr << "Rank " << rank << ", epoch " << epoch << ", Worst: " << bleuWorst*current_input_length << " (" << indexWorst << ")" << endl;
-
- featureValuesHopeSample[batchPosition].push_back(featureValues[batchPosition][indexBest]);
- featureValuesFearSample[batchPosition].push_back(featureValues[batchPosition][indexWorst]);
- //bleuScoresHopeSample[batchPosition].push_back(bleuScores[batchPosition][indexBest]);
- //bleuScoresFearSample[batchPosition].push_back(bleuScores[batchPosition][indexWorst]);
- // updated sentence bleu
- bleuScoresHopeSample[batchPosition].push_back(bleuBest*current_input_length);
- bleuScoresFearSample[batchPosition].push_back(bleuWorst*current_input_length);
- modelScoresHopeSample[batchPosition].push_back(modelScores[batchPosition][indexBest]);
- modelScoresFearSample[batchPosition].push_back(modelScores[batchPosition][indexWorst]);
+ if (bleuBest*current_input_length <= bleuWorst*current_input_length) {
+ cerr << "Rank " << rank << ", epoch " << epoch << ", ERROR: HOPE ist not better than FEAR." << endl;
+ }
+ else {
+ featureValuesHopeSample[batchPosition].push_back(featureValues[batchPosition][indexBest]);
+ featureValuesFearSample[batchPosition].push_back(featureValues[batchPosition][indexWorst]);
+ //bleuScoresHopeSample[batchPosition].push_back(bleuScores[batchPosition][indexBest]);
+ //bleuScoresFearSample[batchPosition].push_back(bleuScores[batchPosition][indexWorst]);
+ // updated sentence bleu
+ bleuScoresHopeSample[batchPosition].push_back(bleuBest*current_input_length);
+ bleuScoresFearSample[batchPosition].push_back(bleuWorst*current_input_length);
+ modelScoresHopeSample[batchPosition].push_back(modelScores[batchPosition][indexBest]);
+ modelScoresFearSample[batchPosition].push_back(modelScores[batchPosition][indexWorst]);
+ }
}
}