A transformer is a Scikit-learn object that learns a transformation from data and applies it to return transformed data. Instantiate it with configuration parameters, fit it on data, then transform that data or later data. section 4.1.2
The common workflow separates configuration, learning, and transformation:
- Instantiate the transformer and assign it to a variable. section 4.1.2
- Call fit(data) to learn parameters from the data. section 4.1.2
- Call transform(data) to map data using the learned transformation. section 4.1.2
Fitting and applying a transformer
A StandardScaler instance illustrates the pattern: processing = StandardScaler().fit(X), followed by processing.transform(X). The fitted object retains information needed for the transformation.
