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?
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)
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.