StandardScaler standardizes numeric features by learning each feature’s mean and standard deviation from fitting data, then applying those statistics to transform data. section 4.1.2
Use the transformer in two distinct steps:
- Fit it on training data so the scaler learns transformation parameters. section 4.1.2
- Transform new, validation, or test data with the fitted scaler, avoiding information leakage between datasets. section 4.1.2
from sklearn.preprocessing import StandardScaler processing = StandardScaler().fit(X)
Instantiate StandardScaler and fit it to feature data, retaining the learned preprocessing parameters for later transformations. section 4.1.2
processing.fit_transform(X)
Fit and transform the same data in one operation when that workflow is appropriate; separate fitting and transformation when controlling dataset boundaries. section 4.1.2

