8000 [MRG+1] raising warning for class_weight in fit method by dsullivan7 · Pull Request #3931 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

[MRG+1] raising warning for class_weight in fit method #3931

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

Merged
merged 5 commits into from
Dec 12, 2014

Conversation

dsullivan7
Copy link
Contributor

This should solve #3928, unless we decide to go the route of warning.

@agramfort
Copy link
Member

I would have remove the param for consistency with other estimators

@amueller wdyt?

@dsullivan7
Copy link
Contributor Author

I think I agree with you actually. The class_weight seems like a parameter that should be kept to being passed only through the constructor.

@dsullivan7
Copy link
Contributor Author

Just pushed a new commit for the warning

warnings.warn("You are trying to set class_weight through the fit "
"method, which will not be possible in a later "
"version of scikit. Pass the class_weight into "
"the constructor instead.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a deprecation warning. Say in which version it will disappear and please say scikit-learn and not just scikit. There are many scikits.

@amueller
Copy link
Member
amueller commented Dec 4, 2014

@agramfort this does remove the parameter (in the next release), right?
I think we should remove it as we try to avoid any parameters to fit. sample_weights needs to be a fit parameter as the shape depends on the data.

@agramfort
Copy link
Member

@agramfort this does remove the parameter (in the next release), right?

in 2 releases so v0.17

I think we should remove it as we try to avoid any parameters to fit. sample_weights needs to be a fit parameter as the shape depends on the data.

yes

@dsullivan7
Copy link
Contributor Author

The last commit should make this merge-able, let me know if there's anything else I can do

@agramfort
Copy link
Member

+1 for merge.

@agramfort agramfort changed the title [MRG] adding support for class_weight in fit method [MRG+1] adding support for class_weight in fit method Dec 10, 2014
@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 5a019b7 on dsullivan7:cwwarn into 5489c84 on scikit-learn:master.

@agramfort
Copy link
Member

this is an uncontroversial PR. Any one to click the green button after my +1?

warnings.simplefilter("always", DeprecationWarning)
clf.fit(X4, Y4, class_weight=1)
assert_true(warning_message == str(w[0].message))
assert_true(issubclass(w[0].category, DeprecationWarning))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use assert_warns?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently, you want to check the exact message that is warned. To do that, you could add assert_warns_regex.

@arjoly
Copy link
Member
arjoly commented Dec 12, 2014

The title is misleading. ;-)

There are stills some tests that use the deprecated parameter passing.

@dsullivan7 dsullivan7 changed the title [MRG+1] adding support for class_weight in fit method [MRG+1] raising warning for class_weight in fit method Dec 12, 2014
@arjoly
Copy link
Member
arjoly commented Dec 12, 2014

When comments are handled, +1 !

@dsullivan7
Copy link
Contributor Author

Alrighty, let me know if that last change looks good. Thanks @arjoly

@arjoly
Copy link
Member
arjoly commented Dec 12, 2014

LGTM

@agramfort
Copy link
Member

that makes 2 +1. merging.

agramfort added a commit that referenced this pull request Dec 12, 2014
[MRG+1] raising warning for class_weight in fit method
@agramfort agramfort merged commit 69d393a into scikit-learn:master Dec 12, 2014
if class_weight is not None:
warnings.warn("You are trying to set class_weight through the fit "
"method, which will be deprecated in version "
"v0.17 of scikit-learn. Pass the class_weight into "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this have been 0.18?

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.

5 participants
0