相关疑难解决方法(0)

如何从 Spacy NER 模型中获得每个实体的预测概率?

我使用这个官方示例代码使用我自己的训练样本从头开始训练一个 NER 模型。

当我在新文本上使用此模型进行预测时,我想获得每个实体的预测概率。

    # test the saved model
    print("Loading from", output_dir)
    nlp2 = spacy.load(output_dir)
    for text, _ in TRAIN_DATA:
        doc = nlp2(text)
        print("Entities", [(ent.text, ent.label_) for ent in doc.ents])
        print("Tokens", [(t.text, t.ent_type_, t.ent_iob) for t in doc])
Run Code Online (Sandbox Code Playgroud)

我无法在 Spacy 中找到一种方法来获得每个实体的预测概率。

我如何从 Spacy 获得这个概率?我需要它来应用截止。

python nlp deep-learning spacy ner

5
推荐指数
1
解决办法
2289
查看次数

标签 统计

deep-learning ×1

ner ×1

nlp ×1

python ×1

spacy ×1