Data flow · ML fundamentals

Leakage-free sklearn preprocessing pipeline

Leakage-free sklearn preprocessing pipeline A raw dataset is split deterministically into train and held-out rows; inside one boundary zone the imputer, scaler and one-hot encoder are fitted on the train split only, the fitted transform feeds model training, and the held-out rows are scored — with a blocked dashed path showing that test rows can never enter the fit. COLUMNTRANSFORMER · FIT ON TRAIN ONLY 01LOAD 02SPLIT 03IMPUTE 04SCALE 05ENCODE 06FIT · SCORE RAW DATA10 ROWS TRAIN SPLIT8 ROWS MODELFITTING TEST SPLIT2 ROWS TRAIN ONLY NEVER FIT SRC Data.csv 10 rows · 5 cols DB SPL Deterministic Split stable sort · every 5th DB DB NUM SimpleImputer mean · numeric cols DB TB NUM StandardScaler numeric columns only TB TB CAT OneHotEncoder cat features · y label TB TB MOD Model Fit on transformed train TB FL TST Held-out Test 2 rows · 5 cols DB DB EVA Test Scoring transform · predict DB FL NODE PIPELINE STAGE TRAIN-ONLY FIT ZONE DATA DB DATASET TB TABLE FL EXPORT LEFT CHIP = INPUT · RIGHT CHIP = OUTPUT FLOW DATA HANDOFF BOUNDARY · TEST CANNOT FIT