ChrfScore returns 0.0 for a missing reference, scoring a dataset gap as a model failure
Small one, raised before I write about it in case I have misread it. Line numbers at commit 298b68274234c060.
_chrf_score.py:36-41: when reference is None (or not a string), the metric returns 0.0.
A missing ground-truth reference is a property of the dataset, not of the model's output, and returning 0.0 records it as though the model produced a maximally wrong answer. It then enters any mean over the dataset indistinguishably from a genuine failure.
Suggestion
As an option: return None or raise for a missing reference and let the caller exclude the sample, so a dataset gap is visible as a gap rather than as a score.
Disclosure
This appears as one instance in a short methods paper about evaluation instruments that state an invariant and do not apply it — most instances in it are from my own code. Telling you first seemed right, and if this is intended behaviour I will say so.
I'd be interested in working on this. Before implementing, would maintainers prefer missing references to produce None/NaN, or should the metric raise a validation error? Happy to open a PR once there's a preference.
Hi, I'd like to work on this issue.
I can reproduce the missing-reference behavior and add regression tests covering missing, invalid, and valid references.
Before implementing the fix, would you prefer raising a ValueError for a missing reference or returning a missing score? I want to preserve the metric's existing API contract and avoid treating missing ground truth as a model failure.
Happy to submit a focused PR with the fix and tests.