From 39d3cbfdbae08fc43a64fdaa38af23b2d80ee1d3 Mon Sep 17 00:00:00 2001 From: Jeffrey Gerard Date: Thu, 12 Oct 2017 11:39:12 -0700 Subject: [PATCH] Bugfix example script train_ner_standalone.py, fails after training --- examples/training/train_ner_standalone.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/training/train_ner_standalone.py b/examples/training/train_ner_standalone.py index e4fb1d1e8..3c2c2781a 100644 --- a/examples/training/train_ner_standalone.py +++ b/examples/training/train_ner_standalone.py @@ -142,16 +142,14 @@ def train(nlp, train_examples, dev_examples, nr_epoch=5): inputs, annots = zip(*batch) nlp.update(list(inputs), list(annots), sgd, losses=losses) scores = nlp.evaluate(dev_examples) - report_scores(i, losses['ner'], scores) - scores = nlp.evaluate(dev_examples) - report_scores(channels, i+1, loss, scores) + report_scores(i+1, losses['ner'], scores) def report_scores(i, loss, scores): precision = '%.2f' % scores['ents_p'] recall = '%.2f' % scores['ents_r'] f_measure = '%.2f' % scores['ents_f'] - print('%d %s %s %s' % (int(loss), precision, recall, f_measure)) + print('Epoch %d: %d %s %s %s' % (i, int(loss), precision, recall, f_measure)) def read_examples(path):