Fix labeller loss for unseen labels

This commit is contained in:
Matthew Honnibal 2017-05-22 10:41:20 -05:00
parent c9760b2104
commit a7ee63c0ac

View File

@ -283,7 +283,7 @@ class NeuralLabeller(NeuralTagger):
guesses = scores.argmax(axis=1)
for gold in golds:
for tag in gold.labels:
if tag is None:
if tag is None or tag not in self.labels:
correct[idx] = guesses[idx]
else:
correct[idx] = self.labels[tag]