# how to write a model.update() function

**URL:** <https://support.prodi.gy/t/how-to-write-a-model-update-function/158>\
**Category:** Uncategorized\
**Tags:** usage, spacy, custom, solved\
**Created:** [December 26, 2017, 12:27pm UTC](https://support.prodi.gy/t/how-to-write-a-model-update-function/158 "2017-12-26T12:27:26Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [December 27, 2017, 12:16pm UTC](https://support.prodi.gy/t/how-to-write-a-model-update-function/158/4 "2017-12-27T12:16:12Z")

</div>

> [@longbowking](#):
>
> However, when we take spacy model as a default one to fullfill chinese ner, i am afraid that all text spans would get the same probability 0. As a consequence, perfer\_function() will not recommend valuable questions.

Yes, to get over the cold start problem, you'll have to start off with examples of the entity first to give the model something to learn from. The `ner.teach` recipe supports passing in a JSONL file containing match patterns (like the patterns used by spaCy's `Matcher`). Prodigy will then start showing you matches of those patterns in your texts. As you annotate those examples, the model is updated and will eventually start suggesting examples as well, based on the updated weights. We actually just recorded a video tutorial that shows this workflow for training a new entity type.  
There's also more information in [this thread](https://support.prodi.gy/t/video-training-a-new-entity-type-with-prodigy/140) and [this comment](https://support.prodi.gy/t/using-custom-entities/141/2).

[![](https://img.youtube.com/vi/l4scwf8KeIA/hqdefault.jpg "TRAINING A NEW ENTITY TYPE with Prodigy – annotation powered by active learning") ](https://www.youtube.com/watch?v=l4scwf8KeIA)

In this example, we use the `terms.teach` recipe to bootstrap a terminology list from word vectors and then convert it to a patterns file using `terms.to-patterns`. But you could also generate the list of patterns manually – see the `PRODIGY_README.html` for an example of what's possible.

---

_[View the full topic](https://support.prodi.gy/t/how-to-write-a-model-update-function/158)._
