Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #551 +/- ##
===========================================
+ Coverage 43.97% 87.28% +43.30%
===========================================
Files 85 100 +15
Lines 7281 10002 +2721
===========================================
+ Hits 3202 8730 +5528
+ Misses 4079 1272 -2807 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #550
Checklist
Current behaviour
For binary labels,
F1::get_scorecomputes(1 + beta²) * p * r / (beta² * p + r)fromPrecisionandRecall. With no true positives both are0, so the score is0 / 0 = NaN. For exampley_true = [0, 1, 0, 1]andy_pred = [0, 0, 0, 0]givesNaN. scikit-learn gives0.0, and the multiclass path inF1already gives0for such a class.New expected behaviour
When
beta² * p + ris0, the binary score is0.0. Other inputs give the same result as before.New test
f1_binary_no_true_positivescovers no positive predictions and all-wrong predictions, forbeta0.5, 1 and 2. It fails onmain(left: NaN, right: 0.0) and passes here.cargo test --lib metrics::f1: 7 passed.Change logs
Changed
metrics: binaryF1returns0when precision and recall are both0. Before this change, it returnedNaN.