Skip to content

Conversation

@betatim
Copy link
Member

@betatim betatim commented Feb 17, 2025

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 from

X_plot = np.linspace(0, 5, 100000)[:, None]

kr = GridSearchCV(
    KernelRidge(kernel="rbf", gamma=0.1),
    param_grid={"alpha": [1e0, 0.1, 1e-2, 1e-3], "gamma": np.logspace(-2, 2, 5)},
)

kr.fit(...)

kr.predict(X_plot)

This fixes this.

@betatim betatim requested a review from a team as a code owner February 17, 2025 12:44
@betatim betatim requested review from csadorf and divyegala February 17, 2025 12:44
@github-actions github-actions bot added the Cython / Python Cython or Python issue label Feb 17, 2025
@betatim betatim added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Feb 18, 2025
Copy link
Contributor

@viclafargue viclafargue left a 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.


@generate_docstring()
@enable_device_interop
def fit(self, X, y, sample_weight=None,
Copy link
Contributor

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.

Copy link
Member Author

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?

Copy link
Contributor

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.

@csadorf
Copy link
Contributor

csadorf commented Feb 20, 2025

/merge

@rapids-bot rapids-bot bot merged commit d7b4d68 into rapidsai:branch-25.04 Feb 20, 2025
68 checks passed
@betatim betatim deleted the kernelridge-0cc branch February 20, 2025 15:49
dantegd added a commit to dantegd/cuml that referenced this pull request Feb 20, 2025
rapids-bot bot pushed a commit that referenced this pull request Feb 23, 2025
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
dantegd added a commit to dantegd/cuml that referenced this pull request Feb 26, 2025
raydouglass pushed a commit that referenced this pull request Feb 28, 2025
PRs being backported: 

- [x] #6234
- [x] #6306
- [x] #6320
- [x] #6319
- [x] #6327
- [x] #6333
- [x] #6142 
- [x] #6223
- [x] #6235
- [x] #6317 
- [x] #6331
- [x] #6326
- [x] #6332
- [x] #6347
- [x] #6348
- [x] #6337
- [x] #6355
- [x] #6354
- [x] #6322
- [x] #6353
- [x] #6359
- [x] #6364
- [x] #6363
- [x] [FIL BATCH_TREE_REORG fix for SM90, 100 and
120](a3e419a)

---------

Co-authored-by: William Hicks <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Cython / Python Cython or Python issue improvement Improvement / enhancement to an existing function non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants