-
Notifications
You must be signed in to change notification settings - Fork 554
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
Make KernelRidge inherit from UniversalBase #6327
Conversation
Support for 0cc
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.
LGTM for the most part, but I would add a test in the test_device_selection.py
file to ensure that training and inference can be done on both CPU or GPU and the conversion between the two is seamless.
@@ -247,6 +255,7 @@ class KernelRidge(Base, RegressorMixin): | |||
filter_params=True, **params) | |||
|
|||
@generate_docstring() | |||
@enable_device_interop | |||
def fit(self, X, y, sample_weight=None, |
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.
Also, small detail, but it is always nice to use the self.n_features_in_
attribute instead of local variable n_rows
when ingesting data. This gives one more thing to replicate sklearn's behavior.
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 mean we should set self.n_features_in_
instead of using a local variable? Can do that. One question, n_features_in_
is the number of features, so shouldn't it be set to n_cols
instead?
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're right meant the number of columns.
/merge |
Previously this wasn't handled correctly, but was _sometimes_ masked by `GridSearchCV` in the old test fixing things behind the scenes. This fixes the bug, adds a test that doesn't require the accelerator, and changes the accelerator test to be both simpler (matching the smoketests in the rest of the file) and much faster (the `GridSearchCV` in the test made the test quite slow on my machine). Fixup to the fix applied in #6327. Authors: - Jim Crist-Harif (https://github.com/jcrist) Approvers: - Dante Gama Dessavre (https://github.com/dantegd) URL: #6354
Support for zero code change acceleration. With the accelerator turned on, the scikit-learn example
./examples/miscellaneous/plot_kernel_ridge_regression.py
fails because it returns a cupy array fromThis fixes this.