Skip to content

sklearn/unscaled-pipeline-estimator

Pack Severity Fix Versions
scikit-learn warning none, edit by hand All versions

Distance, kernel, neural, and SGD estimators (SVR, SVC, KNeighbors*, MLP*, SGD*, KernelRidge) degrade sharply when input features sit on different scales (on features with scale ratio 1:1000, unscaled SVR had RMSE 2.794 vs 1.153 scaled, and KNeighborsRegressor had 2.850 vs 0.827).

pipe = make_pipeline(SimpleImputer(), SVR())
pipe = make_pipeline(SimpleImputer(), StandardScaler(), SVR())

Pipeline and make_pipeline calls containing a strictly scale-sensitive estimator (SVR, SVC, NuSVR, NuSVC, LinearSVR, LinearSVC, KNeighbors*, RadiusNeighbors*, MLP*, SGD*, KernelRidge) with no scaler, normalizer, or ColumnTransformer step.

Insert a scaler (StandardScaler, RobustScaler, MinMaxScaler, PowerTransformer, or QuantileTransformer) before the estimator inside the pipeline, or wrap heterogeneous columns in ColumnTransformer.

This pipeline passes unscaled features into a scale-sensitive estimator (SVR, SVC, KNeighbors, MLP, SGD, or KernelRidge). Add a scaler step (such as StandardScaler or RobustScaler) before the estimator in the pipeline.

See all rules in the scikit-learn pack.