From 2dca9e71a1c23af063a5cac456c66a5e4d96b731 Mon Sep 17 00:00:00 2001 From: ines Date: Mon, 6 Nov 2017 13:17:02 +0100 Subject: [PATCH] Add notes on catastrophic forgetting (see #1496) --- examples/training/train_new_entity_type.py | 4 ++++ website/usage/_install/_troubleshooting.jade | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/examples/training/train_new_entity_type.py b/examples/training/train_new_entity_type.py index 062191440..b43c5b61f 100644 --- a/examples/training/train_new_entity_type.py +++ b/examples/training/train_new_entity_type.py @@ -40,6 +40,10 @@ from spacy.gold import GoldParse, minibatch LABEL = 'ANIMAL' # training data +# Note: If you're using an existing model, make sure to mix in examples of +# other entity types that spaCy correctly recognized before. Otherwise, your +# model might learn the new type, but "forget" what it previously knew. +# https://explosion.ai/blog/pseudo-rehearsal-catastrophic-forgetting TRAIN_DATA = [ ("Horses are too tall and they pretend to care about your feelings", [(0, 6, 'ANIMAL')]), diff --git a/website/usage/_install/_troubleshooting.jade b/website/usage/_install/_troubleshooting.jade index 572c22422..91805119d 100644 --- a/website/usage/_install/_troubleshooting.jade +++ b/website/usage/_install/_troubleshooting.jade @@ -144,3 +144,15 @@ p | novel symbol, #[code -PRON-], which is used as the lemma for | all personal pronouns. For more info on this, see the | #[+api("annotation#lemmatization") annotation specs] on lemmatization. + ++h(3, "catastrophic-forgetting") NER model doesn't recognise other entities anymore after training + +p + | If your training data only contained new entities and you didn't mix in + | any examples the model previously recognised, it can cause the model to + | "forget" what it had previously learned. This is also referred to as the + | #[+a("https://explosion.ai/blog/pseudo-rehearsal-catastrophic-forgetting", true) "catastrophic forgetting problem"]. + | A solution is to pre-label some text, and mix it with the new text in + | your updates. You can also do this by running spaCy over some text, + | extracting a bunch of entities the model previously recognised correctly, + | and adding them to your training examples.