Pipelines
The object that makes leakage impossible by construction, because every fold fits its own preprocessing.
Pipelines
This module needs JavaScript: the numbers are computed in the page rather than recorded.
Worth knowing
fit and one predict.ColumnTransformer applies different steps to different columns, which is how real tables get handled.Overview
Many preprocessing steps learn from data. A scaler estimates means and standard deviations; an imputer estimates fill values; a feature selector uses the target. Fit those steps before splitting and information from validation or test rows can influence the model. A pipeline fits each step on the training portion and applies it to held-out rows.
Many preprocessing steps learn from data. A scaler estimates means and standard deviations; an imputer estimates fill values; a feature selector uses the target. Fit those steps before splitting and information from validation or test rows can influence the model. A pipeline fits each step on the training portion and applies it to held-out rows.