mirror of https://github.com/kubeflow/examples.git
Update seq2seq_utils.py (#51)
Found a mistake with calculation of BLEU Score.
This commit is contained in:
parent
45255b52e3
commit
2ec3b03ed4
|
@ -419,7 +419,11 @@ class Seq2Seq_Inference(object):
|
|||
|
||||
actual.append(self.pp_title.process_text([holdout_titles[i]])[0])
|
||||
predicted.append(self.pp_title.process_text([yhat])[0])
|
||||
|
||||
# calculate BLEU score
|
||||
logging.warning('Calculating BLEU.')
|
||||
bleu = corpus_bleu(actual, predicted)
|
||||
#must be careful with nltk api for corpus_bleu!,
|
||||
# expects List[List[List[str]]] for ground truth, using List[List[str]] will give you
|
||||
# erroneous results.
|
||||
bleu = corpus_bleu([[a] for a in actual], predicted)
|
||||
return bleu
|
||||
|
|
Loading…
Reference in New Issue