fix(evaluators): raise ValueError on empty input instead of ZeroDivisionError - #12572
fix(evaluators): raise ValueError on empty input instead of ZeroDivisionError#12572mturac wants to merge 1 commit into
Conversation
Four of five evaluators (MAP, MRR, Recall, AnswerExactMatch) crash with ZeroDivisionError when passed empty input lists. Mirror the ValueError guard already present in DocumentNDCGEvaluator so all five raise a clear error instead of an arithmetic crash. Closes deepset-ai#12543
|
@mturac is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
|
|
|
Hi @mturac, thanks a lot for your contribution! 🙏 We noticed that the Contributor License Agreement (CLA) check ( To get your PR reviewed, please sign the CLA via the link in the |
fixes #12543
DocumentMAPEvaluator,DocumentMRREvaluator,DocumentRecallEvaluator, andAnswerExactMatchEvaluatorcrash withZeroDivisionErrorwhen called with empty input lists.DocumentNDCGEvaluatorallready handles this correctly with earlyValueError.added same guard to all four evaluators for consistancy — early
ValueErrorinrun()when either input list is empty.added 3 tests per evaluator (12 total) to verify ValueError on empty input. existing evaluator tests still pass.