MNT Consistent warning and more doc about the edge cases of P/R/F#13143
MNT Consistent warning and more doc about the edge cases of P/R/F#13143adrinjalali merged 6 commits intoscikit-learn:masterfrom qinhanmin2014:PRF-warning
Conversation
jnothman
left a comment
There was a problem hiding this comment.
I see now how there is no warning with all-zeros.
|
ping @amueller @adrinjalali @rth to see if you have time. |
sklearn/metrics/classification.py
Outdated
| Notes | ||
| ----- | ||
| When ``true positive + false positive == 0`` or | ||
| ``true positive + false negative == 0``, f-score will be set to 0 |
There was a problem hiding this comment.
f_score returns 0 and raises an UndefinedMetricWarning.
There was a problem hiding this comment.
similar for the other notes.
| raise ValueError("pos_label=%r is not a valid label: %r" % | ||
| (pos_label, present_labels)) | ||
| if pos_label not in present_labels and len(present_labels) >= 2: | ||
| raise ValueError("pos_label=%r is not a valid label: %r" % |
There was a problem hiding this comment.
I'm a bit confused here. This is the only functional part which is changing, but all the new tests are only testing the warning messages. There's no new test which test this change in behavior (i.e. not returning 0,0,0,0).
Doesn't this need a whats_new entry?
There was a problem hiding this comment.
I'm a bit confused here. This is the only functional part which is changing, but all the new tests are only testing the warning messages. There's no new test which test this change in behavior (i.e. not returning 0,0,0,0).
We now calculate these values manually and raise consistent warning in _prf_divide. I guess we don't need a what's new here since the users will only get some extra warnings.
…ikit-learn#13143) * consistent error message * new test * ignore warnings * notes * joel's comment * adrin's comment
…/R/F (scikit-learn#13143)" This reverts commit d931610.
…/R/F (scikit-learn#13143)" This reverts commit d931610.
…ikit-learn#13143) * consistent error message * new test * ignore warnings * notes * joel's comment * adrin's comment
Fixes #10812
Fixes #10843 (I think)
(1) Raise consistent warning about the edge cases of P/R/F, current behavior:
(2) Add some docs to tell users how we handle these edge cases
There's not a clear definition of these edge cases, so I think it's OK to tell users our solution.