-
-
Notifications
You must be signed in to change notification settings - Fork 26.4k
[MRG + 1] add sample_weight into LinearRegression #4881
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
[MRG + 1] add sample_weight into LinearRegression #4881
Conversation
|
I have a question in terms of testing. https://github.com/scikit-learn/scikit-learn/pull/4881/files#diff-f556973f37707f94a71f0ad38243dcf3R54 I copied this line from |
|
Travis build failed because of this error: I cannot reproduce it in my computer and not quite sure why my change is breaking this test. |
|
@TomDLT you might want to have a look. |
sklearn/linear_model/base.py
Outdated
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.
Move _rescale_data to base.py instead.
|
The error comes from
.47 is the lower bound of the correct behavior. Once you think your method is correct, you can take a value below the actual score. The test will check that the score does not decrease with future changes. |
|
Ok, thanks. Will fix it later this week. |
71bab9d to
3d1b3a8
Compare
5d625c0 to
7a6dc09
Compare
|
This is ready for code review. Thanks. |
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.
you can delete this now
|
LGTM |
sklearn/linear_model/base.py
Outdated
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 think this method should stay private
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.
rescale_data -> _rescale_data
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.
rescale_data is used in ridge.py as well. Though in some sense, it is private to linear_model.
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.
+1 for making it private
|
Please clean up your commit message too. Thanks! |
|
Thanks for feedback. Will clean PR up this weekend! |
804ff31 to
8611966
Compare
|
Hey all, the only question left now is if we want to keep a scalar |
|
Was it possible to use scalar sample weight in Ridge before? If so, we would at least need to deprecate it before removing it. |
|
Then I'd leave it for the time being. |
|
Hmm, ok. So leave |
|
Hey, I would appreciate if anyone has some inputs. I want to close this during this weekend. Thanks! |
|
I would leave it as is but remove it from the docstring. It's not worth going through a deprecation cycle. You can think of it as broadcasting rule, like in NumPy. |
|
Ok, thanks! |
8611966 to
60da31d
Compare
|
Ok, done. |
58a60fb to
3d0ae81
Compare
|
LGTM 👍 |
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.
can you add another model here that has no sample weights?
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.
Added LogisticRegression
|
looks good apart from minor nitpicks |
3d0ae81 to
532d6f3
Compare
|
Cool. Fixed. Thanks! |
|
The apveyor failure is related. And I'm not sure why travis is not running :-/ |
|
maybe column_or_1d can't handle scalars :-/ |
|
Hmm, ok. I changed back to |
532d6f3 to
971c806
Compare
|
@amueller Hey, could you take a look at the final change please? Thanks! |
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.
these are not used anywhere, right?
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.
Yeah. Thanks.
|
apart from the nitpick in the testing, this looks good. |
971c806 to
a88f6ec
Compare
|
LGTM. Thank you! Merging |
[MRG + 1] add sample_weight into LinearRegression
|
Thanks! |
Working on #4735