Bugfix example script train_ner_standalone.py, fails after training
@@ -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):
