Skip to content

[BUG] 'normalize' in LinearRegression deprecated in scikit-learn 1.0 #4795

@mmccarty

Description

@mmccarty

Describe the bug
PR scikit-learn/scikit-learn#17743 released in sklearn v1.0 makes an API change that is not reflected in cuml.

See release notes for detail.

Steps/Code to reproduce bug
Follow this guide http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports to craft a minimal bug report. This helps us reproduce the issue you're having and resolve the issue more quickly.

import numpy as np
from sklearn.linear_model import LinearRegression
X = np.array([[1, 1], [1, 2], [2, 2], [2, 3]])
y = np.dot(X, np.array([1, 2])) + 3
reg = LinearRegression(fit_intercept=True,
                            normalize=True,
                            n_jobs=-1).fit(X, y)

Results in a warning...

/home/mmccarty/miniconda3/envs/rapids-22.06/lib/python3.9/site-packages/sklearn/linear_model/_base.py:141: FutureWarning: 'normalize' was deprecated in version 1.0 and will be removed in 1.2.
If you wish to scale the data, use Pipeline with a StandardScaler in a preprocessing stage. To reproduce the previous behavior:

from sklearn.pipeline import make_pipeline

model = make_pipeline(StandardScaler(with_mean=False), LinearRegression())

If you wish to pass a sample_weight parameter, you need to pass it as a fit parameter to each step of the pipeline as follows:

kwargs = {s[0] + '__sample_weight': sample_weight for s in model.steps}
model.fit(X, y, **kwargs)


  warnings.warn(

However, cuml.linear_model.LinearRegression doesn't issue a warning.

Expected behavior
cuml estimator match the behavior of sklearn.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions