Skip to content

Accelerate StandardScaler, MinMaxScaler, and LabelEncoder via sklearn's array API dispatch - #8013

Closed
csadorf wants to merge 13 commits into
NVIDIA:mainfrom
csadorf:use-array-api-to-wrap-preprocessors
Closed

Accelerate StandardScaler, MinMaxScaler, and LabelEncoder via sklearn's array API dispatch#8013
csadorf wants to merge 13 commits into
NVIDIA:mainfrom
csadorf:use-array-api-to-wrap-preprocessors

Conversation

@csadorf

@csadorf csadorf commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Adds GPU acceleration for sklearn.preprocessing.StandardScaler, MinMaxScaler, and LabelEncoder in cuml.accel by routing their fit, transform, fit_transform, inverse_transform, and partial_fit methods 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, enables array_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

@copy-pr-bot

copy-pr-bot Bot commented Apr 24, 2026

Copy link
Copy Markdown

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.

@github-actions github-actions Bot added the Cython / Python Cython or Python issue label Apr 24, 2026
@csadorf csadorf added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change and removed Cython / Python Cython or Python issue labels Apr 24, 2026
@csadorf

csadorf commented Apr 24, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 8ca9c0f

@@ -0,0 +1,174 @@
# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we had agreed to leave the preprocessors in cuml proper alone for now?

@csadorf

csadorf commented Apr 30, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #8020 and #8032 .

@csadorf csadorf closed this Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Add cuml.accel support for MinMaxScaler

4 participants