-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
SGDClassifier -- class_weights & sample_weights #3928
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
Comments
I think multiplicative weights are fine, but should be documented. |
@dsullivan7 any insight? |
It is probably a good idea to raise a warning for a release and then deprecate the unused parameter after that. Just so I understand, the use case for I can go ahead and add the warning. |
Actually, I'm looking at it again. What do you think about overriding the |
Take a look at this PR. It adds support for passing class_weight into the fit method. I can make it a warning instead though if that's what we want to do. |
we like to avoid fit parameters as much as possible. |
Easy one first, there is an unused
class_weight
parameter in thefit
method signature,class_weight
flows in through the constructor:https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/linear_model/stochastic_gradient.py#L527
Just to prove it:
Now weighting the samples in different (equivalent) ways:
All fine so far, but if you do both
class_weight
in the constructor andsample_weights
in the fitting, the resulting weights appear to be multiplicative.Whether this is desirable or not is one thing, but it does not appear to be documented anywhere, ie neither
class_weight
norsample_weight
refer to one another in their docstrings. I feel like perhaps a warning or error should be raised, or at least a mention of the interaction in the docstring.The text was updated successfully, but these errors were encountered: