-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
[MRG] Adding pos_label parameter to roc_auc_score #9567
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
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9312a17
add pos_label parameter
qinhanmin2014 7e2b756
add pos_label parameter
qinhanmin2014 e8226ac
minor update
qinhanmin2014 ed34f9e
remove support for multilabel-indicator
qinhanmin2014 d362222
pep fix
qinhanmin2014 4f1b98c
raise error
qinhanmin2014 a049a8b
support pos_label = 1
qinhanmin2014 2e5037f
minor update
qinhanmin2014 1c0e336
move test to test_common
qinhanmin2014 644fb0a
minor improve
qinhanmin2014 a36fe3a
Merge branch 'master' into my-feature-4
qinhanmin2014 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -257,6 +257,7 @@ | |
|
||
"macro_f0.5_score", "macro_f1_score", "macro_f2_score", | ||
"macro_precision_score", "macro_recall_score", | ||
"roc_auc_score", | ||
] | ||
|
||
# Metrics with a "labels" argument | ||
|
@@ -595,7 +596,7 @@ def test_invariance_string_vs_numbers_labels(): | |
|
||
for name, metric in THRESHOLDED_METRICS.items(): | ||
if name in ("log_loss", "hinge_loss", "unnormalized_log_loss", | ||
"brier_score_loss"): | ||
"brier_score_loss", "roc_auc_score"): | ||
# Ugly, but handle case with a pos_label and label | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure what "and label" means here. Any idea? What metrics are we excluding here? Why do we need an explicit list of names where otherwise these lists are defined at the top with meaningful names? I know it's not your problem, but this is a mess :\ |
||
metric_str = metric | ||
if name in METRICS_WITH_POS_LABEL: | ||
|
@@ -607,7 +608,7 @@ def test_invariance_string_vs_numbers_labels(): | |
err_msg="{0} failed string vs number " | ||
"invariance test".format(name)) | ||
|
||
measure_with_strobj = metric(y1_str.astype('O'), y2) | ||
measure_with_strobj = metric_str(y1_str.astype('O'), y2) | ||
assert_array_equal(measure_with_number, measure_with_strobj, | ||
err_msg="{0} failed string object vs number " | ||
"invariance test".format(name)) | ||
|
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
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.
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.
I don't think this affects any common tests. There are two uses of
METRICS_WITH_POS_LABEL
. One does not apply, I think; the other I suspect should apply but is being explicitly limited to a handful of metrics in a way that is very ugly and IMO inappropriate...(Although I'm also confused why
roc_auc_score
is inMETRICS_UNDEFINED_BINARY
rather thanMETRICS_UNDEFINED_MULTICLASS
.)I'd appreciate if you could do a bit of an audit of the common tests wrt
roc_auc_score
and related metrics.