Train-Only Preprocessing, Exactly
Assigning split roles before touching features, fitting min and max strictly on training rows, scaling training and held-out rows against frozen bounds, seeing how full-data fitting shifts every number, and what train-only preprocessing does and does not guarantee.
Fitting Bounds on Train and Freezing Them for Test
Partition role labels first, fit min and max strictly on training rows, map training and held-out features onto the frozen scale, and compare honest scaling against leaked full-data scaling.
- Roles Come First
partition role == 1 and role == 0 before computing any feature bound
- Fit Min and Max on Train
fit tr_min, tr_max, and tr_span on role == 1 rows exclusively
- Scale the Train Rows
map training rows onto [0, 1] with (x - tr_min) / (tr_max - tr_min)
- Apply the Train Fit to Test
apply frozen (x - tr_min) / tr_span to test rows—never refit on test
- Full-Data Fit Changes the Numbers
one held-out spike at 50 halves every training coordinate when leaked
- What Train-Only Preprocessing Does and Does Not Say
train-only scaling eliminates scaler leakage, not extrapolation risk