在 SpaCy NER 训练中设置验证数据
Set validation data in SpaCy NER training
是否可以使用验证数据训练 SpaCy NER?
或者像 Keras 那样将一些数据拆分到验证集(validation_split in model.fit)?谢谢
with nlp.disable_pipes(*other_pipes): # only train NER
for itn in tqdm(range(n_iter)):
random.shuffle(train_data_list)
losses = {}
# batch up the examples using spaCy's minibatch
batches = minibatch(train_data_list, size=compounding(8., 64., 1.001))
for batch in batches:
texts, annotations = zip(*batch)
nlp.update(texts, annotations, sgd=optimizer, drop=0.35,
losses=losses)
使用 spacy train
CLI 而不是演示脚本:
spacy train lang /path/to/output train.json dev.json
验证数据用于从训练迭代中选择最佳模型,并可选择提前停止。
主要任务是将您的数据转换为 spacy 的 JSON 训练格式,请参阅:
是否可以使用验证数据训练 SpaCy NER? 或者像 Keras 那样将一些数据拆分到验证集(validation_split in model.fit)?谢谢
with nlp.disable_pipes(*other_pipes): # only train NER
for itn in tqdm(range(n_iter)):
random.shuffle(train_data_list)
losses = {}
# batch up the examples using spaCy's minibatch
batches = minibatch(train_data_list, size=compounding(8., 64., 1.001))
for batch in batches:
texts, annotations = zip(*batch)
nlp.update(texts, annotations, sgd=optimizer, drop=0.35,
losses=losses)
使用 spacy train
CLI 而不是演示脚本:
spacy train lang /path/to/output train.json dev.json
验证数据用于从训练迭代中选择最佳模型,并可选择提前停止。
主要任务是将您的数据转换为 spacy 的 JSON 训练格式,请参阅: