Skip to content

Fix roc #6693

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

Closed
wants to merge 2 commits into from
Closed

Fix roc #6693

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion sklearn/metrics/ranking.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# Lars Buitinck
# Joel Nothman <joel.nothman@gmail.com>
# Noel Dawe <noel@dawe.me>
# Maximilian Soelch <m.soelch@tum.de>
# License: BSD 3 clause

from __future__ import division
Expand Down Expand Up @@ -328,8 +329,11 @@ def _binary_clf_curve(y_true, y_score, pos_label=None, sample_weight=None):
# concatenate a value for the end of the curve.
# We need to use isclose to avoid spurious repeated thresholds
# stemming from floating point roundoff errors.
# Setting the tolerances to higher values than 0.0 will cause unexpected
# behavior for low variance y_score arrays.
distinct_value_indices = np.where(np.logical_not(isclose(
np.diff(y_score), 0)))[0]
np.diff(y_score), 0, atol=0.0, rtol=0.0)))[0]

threshold_idxs = np.r_[distinct_value_indices, y_true.size - 1]

# accumulate the true positives with decreasing threshold
Expand Down