rasbt / mlxtend

A library of extension and helper modules for Python's data analysis and machine learning libraries.
https://rasbt.github.io/mlxtend/
Other
4.82k stars 853 forks source link

Arg normalize to sklearn.linear_model.LinearRegression has been removed in version 1.2 #1035

Closed carlsmedstad closed 1 year ago

carlsmedstad commented 1 year ago

Describe the bug

The following will fail for scikit-learn version 1.2:

sklearn.linear_model.LinearRegression(normalize=True)

Docs for 1.0: https://scikit-learn.org/1.0/modules/generated/sklearn.linear_model.LinearRegression.html?highlight=linearregression#sklearn.linear_model.LinearRegression

Docs for 1.2: https://scikit-learn.org/1.2/modules/generated/sklearn.linear_model.LinearRegression.html?highlight=linearregression#sklearn.linear_model.LinearRegression

carlsmedstad commented 1 year ago

After these changes the test pass:

sed -i 's/LinearRegression(normalize=True)/LinearRegression()/g' \
  mlxtend/regressor/tests/test_stacking_regression.py \
  mlxtend/regressor/tests/test_stacking_cv_regression.py
namanmistry commented 1 year ago

Hey, In the old docs of sklearn for normalize parameter it was written:

This parameter is ignored when fit_intercept is set to False. If True, the regressors X will be normalized before regression by subtracting the mean and dividing by the l2-norm. 

And fit_intercept defaults to True in the newer version of sklearn. So can we directly remove normalize argument? I think it wont effect the functionality because it is still normalizing.

rasbt commented 1 year ago

Thanks for the note & thanks for addressing that in PR #1036!