Skip to content

don't score an empty F1 gold reference as zero - #1354

Open
gyanu2507 wants to merge 1 commit into
huggingface:mainfrom
gyanu2507:fix/f1-empty-gold
Open

don't score an empty F1 gold reference as zero#1354
gyanu2507 wants to merge 1 commit into
huggingface:mainfrom
gyanu2507:fix/f1-empty-gold

Conversation

@gyanu2507

Copy link
Copy Markdown

Fixes #1353

F1_score maps nltk's None onto 0.0. That's fine when the prediction bag is empty (undefined precision → miss). It's wrong when the gold bag is empty after normalize — that's bad reference data, not a model failure, and np.mean then treats it like a real zero.

Raise ValueError for empty gold. Empty pred still scores 0.0.

nltk returns None for undefined recall, and we were scoring that as 0.
An empty gold is bad eval data, not a model miss. Empty preds stay 0.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

F1_score collapses nltk's undefined result onto zero, including when the gold reference is empty

1 participant