683d81bb49096867f5ad8d3dde23217ea54d6790,examples/training/train_new_entity_type.py,,train_ner,#Any#Any#Any#,41

Before Change


            //for i in range(len(gold.ner)):
                //if not gold.ner[i].endswith("ANIMAL"):
                //    gold.ner[i] = "-"
            doc = nlp.make_doc(raw_text)
            nlp.tagger(doc)
            // As of 1.9, spaCy"s parser now lets you supply a dropout probability
            // This might help the model generalize better from only a few
            // examples.
            loss += nlp.entity.update(doc, gold, drop=0.9)
        if loss == 0:
            break
    // This step averages the model"s weights. This may or may not be good for
    // your situation --- it"s empirical.

After Change


    nlp.meta["name"] = "en_ent_animal"
    for itn in range(50):
        losses = {}
        for batch in minibatch(get_gold_parses(nlp.make_doc, train_data), size=3):
            docs, golds = zip(*batch)
            nlp.update(docs, golds, losses=losses, sgd=optimizer, update_shared=True,
                       drop=0.35)
        print(losses)
    if not output_dir:
        return
    elif not output_dir.exists():
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: explosion/spaCy
Commit Name: 683d81bb49096867f5ad8d3dde23217ea54d6790
Time: 2017-09-14
Author: honnibal+gh@gmail.com
File Name: examples/training/train_new_entity_type.py
Class Name:
Method Name: train_ner


Project Name: explosion/spaCy
Commit Name: 8e7414daceed0a4f9d58dd12ad2f22be7f0097be
Time: 2019-10-27
Author: svlandeg@users.noreply.github.com
File Name: examples/training/ner_multitask_objective.py
Class Name:
Method Name: main


Project Name: explosion/spaCy
Commit Name: fe498b3d5e1e29fb756c203d50e217e8f258e561
Time: 2017-11-06
Author: ines@ines.io
File Name: examples/training/train_ner.py
Class Name:
Method Name: main