1. Learn
  2. /
  3. Courses
  4. /
  5. Natural Language Processing with spaCy

Exercise

Train an existing NER model

A spaCy model may not work well on a given data. One solution is to train the model on our data. In this exercise, you will practice training a NER model in order to improve its prediction performance.

A spaCy en_core_web_sm model that is accessible as nlp, which is not able to correctly predict house as an entity in a test string.

Given a training_data, write the steps to update this model while iterating through the data two times. The other pipelines are already disabled and optimizer is also ready to be used. Number of epochs is already set to 2.

Instructions

100 XP
  • Use the optimizer object and for each epoch, shuffle the dataset using random package and create an Example object.
  • Update the nlp model using .update attribute and set the sgd arguments to use the optimizer.