New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Weighted average scores no nan #14595
Merged
adrinjalali
merged 9 commits into
scikit-learn:master
from
amueller:weighted_average_scores_no_nan
Aug 14, 2019
Merged
Weighted average scores no nan #14595
adrinjalali
merged 9 commits into
scikit-learn:master
from
amueller:weighted_average_scores_no_nan
Aug 14, 2019
Conversation
This file contains 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
Some metrics can produce NaN scores which are however 0-weighted (e.g. PR curve score calculated on class with no positive ground truth samples in the batch). When directly taking weighted average of them, the NaN scores can cause the average score to be NaN, even if they are 0-weighted. To prevent this, before taking the average, we force the scores with 0 weight to be 0, so that they will not pose effect on the final average score.
These failures are somewhat disconcerning, in particular because they are version-dependent?! |
I fix |
actually good for reviews now. |
What should it say? Allowing averaging metrics in the absence of true positives? Sure. |
I tend to find "fixed a bug where" helps me formulate something meaningful
for users struck with that issue.
|
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.
Finishes #10891 by adding a regression test.
If there's no positives the code raises a division by zero warning, and there's a test that the warning is raised. I'm not sure if that's useful, but I'm keeping with the current behavior. For the case in #10891 I'm still raising the warning but providing a useful number.