-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
[MRG+2]: Fix Ridge GCV with centered data #6178
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
@@ -854,7 +859,11 @@ def _errors_and_values_helper(self, alpha, y, v, Q, QT_y): | |||
----- | |||
We don't construct matrix G, instead compute action on y & diagonal. | |||
""" | |||
w = 1.0 / (v + alpha) | |||
w = 1. / (v + alpha) | |||
dummy_column = np.var(Q, 0) < 1.e-12 |
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 that I would call this "constant_column" rather than "dummy_column", no?
A few minor comments that I would like addressed :) |
|
||
centered_kernel = True | ||
if sparse.issparse(X) or not self.fit_intercept: | ||
centered_kernel = False |
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.
This could be written:
centered_kernel = not sparse.issparse(X) and self.fit_intercept
LGTM as well. @mblondel do you want to have a look? Otherwise we can merge. |
…ble with sparse matrices
@ogrisel, addressed your comments and rebased on master. |
Thanks for the fix! Feel free to merge without my review. |
flake8 is complaining ;) |
Fixed. |
Merged. I will add a whats new to master directly. |
# Conflicts: # doc/whats_new.rst
Addresses #1807
The following code solves it correctly as far as I can see. I've tried to deal cleanly with sample weight and sparse matrices, as well as the direct/kernel fomulations.
Comments welcome !