-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
[MRG] BUG Remove pos_label in plot_roc_auc_curve #15555
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
[MRG] BUG Remove pos_label in plot_roc_auc_curve #15555
Conversation
sklearn/metrics/_plot/roc_curve.py
Outdated
|
||
if is_classifier(estimator): | ||
if len(estimator.classes_) != 2: | ||
raise ValueError(classificaiton_error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise ValueError(classificaiton_error) | |
raise ValueError(classification_error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good apart from typo.
Can you open a follow-up issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, this is actually my solution at the beginning
@qinhanmin2014's PR #15316 also had additional tests for |
def test_plot_roc_curve_pos_label(pyplot, data_binary):
X, y = data_binary
y = np.array(["neg", "pos"])[y]
lr = LogisticRegression()
lr.fit(X, y)
y_pred = lr.predict_proba(X)[:, 1]
viz = plot_roc_curve(lr, X, y)
assert_allclose(viz.roc_auc, roc_auc_score(y, y_pred))
def test_plot_roc_curve_pos_label_non_standard_integers(pyplot, data_binary):
X, y = data_binary
y = np.array([1, 2])[y]
lr = LogisticRegression()
lr.fit(X, y)
y_pred = lr.predict_proba(X)[:, 1]
viz = plot_roc_curve(lr, X, y)
assert_allclose(viz.roc_auc, roc_auc_score(y, y_pred)) |
I'll open a PR but I guess that's not so important. |
@ogrisel Thomas already updates
|
Reference Issues/PRs
Resolves #15405
Alternative to #15316
Alternative to #15405
What does this implement/fix? Explain your changes.
Remove
pos_label
fromplot_roc_auc_curve
and always infer from the estimator.Any other comments?
Three PRs one issue :/
CC @amueller