deepset-ai / FARM

:house_with_garden: Fast & easy transfer learning for NLP. Harvesting language models for the industry. Focus on Question Answering.
https://farm.deepset.ai
Apache License 2.0
1.73k stars 247 forks source link

Add switch to QA pred head for ranking by confidence scores #836

Closed julian-risch closed 3 years ago

julian-risch commented 3 years ago

QACandidates contain score and confidence fields but only score was used to rank QACandidates so far. This PR makes ranking QACandidates by score the default but also allows to set use_confidence_scores_for_ranking in QAPredictionHead, which activates ranking QACandidates by confidence.

I think, it's better to keep both fields, score and confidence in QACandidates instead of dropping one of them entirely. Thereby, we are more flexible and allow backwards compatibility.

A new test case checks that results are ranked as expected with and without setting use_confidence_scores_for_ranking.

closes #808