3
$\begingroup$

My current custom NER model is good on recall but I want to focus on improving precision, is it possible to change the optimizer metric in config file?

$\endgroup$

2 Answers 2

1
$\begingroup$

You can change how the model weights precision/recall/f1 by modifying your config file.

[training.score_weights]
ents_per_type = null
ents_f = 1.0
ents_p = 0.0
ents_r = 0.0

This gives full weight to f1, but you could change it to have ents_p = 0.75 and ents_r = 0.25.

(This same question came up on the spaCy Discussions)

$\endgroup$
2
$\begingroup$

I don' know Spacy custom NER but it's unlikely that the model is optimized on recall, otherwise it would label absolutely everything as an entity in order to reach perfect recall.

Your model happens to have a good recall, but it doesn't meant that the algorithm optimizes for this. There might be some technical parameters but it's very likely that the performance depends mostly on the training data. If you obtain very good recall but bad precision, it might be because the training data contains a higher proportion of entities than the test data. If this is the case, the way to improve precision is to provide more negative examples, e.g. sentences without any entities. This should improve precision since the model will be more careful about negative words, but it will probably also decrease recall.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.