Accelerate StandardScaler, MinMaxScaler, and LabelEncoder via sklearn's array API dispatch - #8013
Closed
csadorf wants to merge 13 commits into
Closed
Accelerate StandardScaler, MinMaxScaler, and LabelEncoder via sklearn's array API dispatch#8013csadorf wants to merge 13 commits into
StandardScaler, MinMaxScaler, and LabelEncoder via sklearn's array API dispatch#8013csadorf wants to merge 13 commits into
Conversation
Use ensure_host(y) instead of np.asanyarray(y) so that cupy arrays passed in (e.g. from Pipeline transformations) are moved to host before np.unique runs. Made-with: Cursor
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Contributor
Author
|
/ok to test 8ca9c0f |
betatim
reviewed
Apr 28, 2026
| @@ -0,0 +1,174 @@ | |||
| # SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION. | |||
Contributor
There was a problem hiding this comment.
I thought we had agreed to leave the preprocessors in cuml proper alone for now?
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds GPU acceleration for
sklearn.preprocessing.StandardScaler,MinMaxScaler, andLabelEncoderincuml.accelby routing theirfit,transform,fit_transform,inverse_transform, andpartial_fitmethods through sklearn's built-in array API dispatch path with CuPy arrays.Rather than using
ProxyBase(which requires a separate cuML GPU implementation), these estimators are monkey-patched in place. When the input is accelerable (numeric dtype, non-sparse, non-DataFrame), the patch converts the input to a CuPy array, temporarily promotes fitted attributes to the device, enablesarray_api_dispatch=True, and calls the original sklearn method. Fitted attributes are stored as NumPy after fit for user-visible consistency; they are promoted to CuPy only during accelerated calls.I decided to not support dataframe-input for now since it made the patch path significantly more complex.
Modeled partially after #7843
Closes #8014 #8015