Spacy 3 NER Scorer() Throws TypeError: Score() Takes 2 Positional Arguments But 3 Were Given
Running into the following error when trying to get scores on my test set using Scorer TypeError: score() takes 2 positional arguments but 3 were given import spacy from spacy.t
Solution 1:
Since spaCy v3, scorer.score just takes a list of examples. Each Exampleobject holds two Doc objects:
- one
referencedoc with the gold-standard annotations, created for example from the givenannotdictionary - one
predicteddoc with the predictions. The scorer will then compare the two.
So you want something like this:
from spacy.training import Example
examples = []
for ...:
example = Example.from_dict(text, {"entities": annot})
example.predicted = ner_model(example.predicted)
examples.append(example)
scorer.score(examples)
Post a Comment for "Spacy 3 NER Scorer() Throws TypeError: Score() Takes 2 Positional Arguments But 3 Were Given"