[MRG] BUG Remove pos_label in plot_roc_auc_curve#15555
Merged
qinhanmin2014 merged 2 commits intoscikit-learn:masterfrom Nov 7, 2019
Merged
[MRG] BUG Remove pos_label in plot_roc_auc_curve#15555qinhanmin2014 merged 2 commits intoscikit-learn:masterfrom
qinhanmin2014 merged 2 commits intoscikit-learn:masterfrom
Conversation
amueller
reviewed
Nov 6, 2019
amueller
reviewed
Nov 6, 2019
sklearn/metrics/_plot/roc_curve.py
Outdated
|
|
||
| if is_classifier(estimator): | ||
| if len(estimator.classes_) != 2: | ||
| raise ValueError(classificaiton_error) |
Member
There was a problem hiding this comment.
Suggested change
| raise ValueError(classificaiton_error) | |
| raise ValueError(classification_error) |
amueller
reviewed
Nov 6, 2019
amueller
approved these changes
Nov 7, 2019
Member
amueller
left a comment
There was a problem hiding this comment.
looks good apart from typo.
Can you open a follow-up issue?
qinhanmin2014
approved these changes
Nov 7, 2019
Member
qinhanmin2014
left a comment
There was a problem hiding this comment.
LGTM, this is actually my solution at the beginning
Member
|
@qinhanmin2014's PR #15316 also had additional tests for |
Member
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)) |
Member
|
I'll open a PR but I guess that's not so important. |
Member
|
@ogrisel Thomas already updates |
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.
Reference Issues/PRs
Resolves #15405
Alternative to #15316
Alternative to #15405
What does this implement/fix? Explain your changes.
Remove
pos_labelfromplot_roc_auc_curveand always infer from the estimator.Any other comments?
Three PRs one issue :/
CC @amueller