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.

  1. Roles Come First

    partition role == 1 and role == 0 before computing any feature bound

  2. Fit Min and Max on Train

    fit tr_min, tr_max, and tr_span on role == 1 rows exclusively

  3. Scale the Train Rows

    map training rows onto [0, 1] with (x - tr_min) / (tr_max - tr_min)

  4. Apply the Train Fit to Test

    apply frozen (x - tr_min) / tr_span to test rows—never refit on test

  5. Full-Data Fit Changes the Numbers

    one held-out spike at 50 halves every training coordinate when leaked

  6. What Train-Only Preprocessing Does and Does Not Say

    train-only scaling eliminates scaler leakage, not extrapolation risk