-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
[MRG+1] Add sample_weight parameter to cohen_kappa_score #7569
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
Conversation
Is there any blocking issue for this PR? |
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.
Please add a test. The blocking thing is that we are low on man power for reviews. Sorry about that. Regular pings might help ;)
@@ -368,7 +368,6 @@ | |||
|
|||
# No Sample weight support | |||
METRICS_WITHOUT_SAMPLE_WEIGHT = [ | |||
"cohen_kappa_score", |
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.
Hm I would expect you need to add it in some other places now?
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.
As far as I understand, no. It's already in CLASSIFICATION_METRICS, which is in ALL_METRICS, which means it will now be tested by test_sample_weight_invariance().
doc/whats_new.rst
Outdated
@@ -31,6 +31,9 @@ Enhancements | |||
<https://github.com/scikit-learn/scikit-learn/pull/4939>`_) by `Andrea | |||
Esuli`_. | |||
|
|||
- Add ``sample_weight`` parameter to `metrics.cohen_kappa_score`. By Victor |
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.
:func:metric.cohen_kappa_score
LGTM Although frankly, I'm not sure if the author's list should be modified so quickly on a file, even if I admit you should be credited for the change (and will be in the git history and changelog in any case). Authors lists at the top of the file often help us seek advice from an expert when there are maintenance issues. I don't think this change indicates expertise. As for myself, if I remember to, I put my name on a file when I make a substantial change and should be credited for not just the work on that file, but the expertise necessary to maintain it. |
@jnothman feel free to remove it. I thought it was required for copyright issues, but as far as credit go I really don't mind either way. |
Reference Issue
NA
What does this implement/fix? Explain your changes.
This adds a sample_weight parameter to sklearn.metrics.cohen_kappa_score. The implementation simply forwards the argument to the underlying confusion_matrix call.
Any other comments?
It would be better to add a specific test in test_cohen_kappa() (here), but I don't know how to get reference kappa values for this test. Note that cohen_kappa_score is removed from METRICS_WITHOUT_SAMPLE_WEIGHT in test_common.py, which should provide additional testing, although not specific to this metric.
Finally I couldn't manage to run the full test suite locally so I'm relying on travis-ci here.