8000 [MRG+1] Add sample_weight parameter to cohen_kappa_score by vpoughon · Pull Request #7569 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

[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

Closed

Conversation

vpoughon
Copy link
Contributor
@vpoughon vpoughon commented Oct 4, 2016

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.

@vpoughon
Copy link
Contributor Author

Is there any blocking issue for this PR?

Copy link
Member
@amueller amueller left a 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",
Copy link
Member

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?

Copy link
Contributor Author

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().

@@ -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
Copy link
Member

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

@jnothman
Copy link
Member
jnothman commented Nov 9, 2016

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 jnothman changed the title [MRG] Add sample_weight parameter to cohen_kappa_score [MRG+1] Add sample_weight parameter to cohen_kappa_score Nov 9, 2016
@vpoughon
Copy link
Contributor Author
vpoughon commented Nov 9, 2016

@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.
Plus I definitely won't be much help regarding expert advice on the rest of the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0