4cd9ec0f00788d08c053b885b5591fe134666a65,examples/training/train_ner.py,,main,#Any#Any#Any#,35
Before Change
for itn in range(n_iter):
random.shuffle(TRAIN_DATA)
losses = {}
for text, annotations in TRAIN_DATA:
nlp.update(
[text], // batch of texts
[annotations], // batch of annotations
drop=0.5, // dropout - make it harder to memorise data
sgd=optimizer, // callable to update weights
losses=losses)
print(losses)
// test the trained model
for text, _ in TRAIN_DATA:
After Change
random.shuffle(TRAIN_DATA)
losses = {}
// batch up the examples using spaCy"s minibatch
batches = minibatch(TRAIN_DATA, size=compounding(4., 32., 1.001))
for batch in batches:
texts, annotations = zip(*batch)
nlp.update(
texts, // batch of texts
annotations, // batch of annotations
drop=0.5, // dropout - make it harder to memorise data
sgd=optimizer, // callable to update weights
losses=losses)
print("Losses", losses)
// test the trained model
for text, _ in TRAIN_DATA:
In pattern: SUPERPATTERN
Frequency: 5
Non-data size: 15
Instances
Project Name: explosion/spaCy
Commit Name: 4cd9ec0f00788d08c053b885b5591fe134666a65
Time: 2018-10-09
Author: ines@ines.io
File Name: examples/training/train_ner.py
Class Name:
Method Name: main
Project Name: explosion/spaCy
Commit Name: 4cd9ec0f00788d08c053b885b5591fe134666a65
Time: 2018-10-09
Author: ines@ines.io
File Name: examples/training/train_ner.py
Class Name:
Method Name: main
Project Name: explosion/spaCy
Commit Name: 4cd9ec0f00788d08c053b885b5591fe134666a65
Time: 2018-10-09
Author: ines@ines.io
File Name: examples/training/train_tagger.py
Class Name:
Method Name: main
Project Name: explosion/spaCy
Commit Name: 4cd9ec0f00788d08c053b885b5591fe134666a65
Time: 2018-10-09
Author: ines@ines.io
File Name: examples/training/train_parser.py
Class Name:
Method Name: main
Project Name: explosion/spaCy
Commit Name: 4cd9ec0f00788d08c053b885b5591fe134666a65
Time: 2018-10-09
Author: ines@ines.io
File Name: examples/training/train_new_entity_type.py
Class Name:
Method Name: main
Project Name: explosion/spaCy
Commit Name: 4cd9ec0f00788d08c053b885b5591fe134666a65
Time: 2018-10-09
Author: ines@ines.io
File Name: examples/training/train_intent_parser.py
Class Name:
Method Name: main