Data Leakage in Model Evaluation
Identify information a model would lack at prediction time and prevent preprocessing and grouping choices from exposing it during evaluation.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Availability matters more than column names
A model predicting whether a shipment will be late should only see fields available at the time that prediction is made. A final delivery timestamp, or a status updated only after arrival, can leak the answer even when its name looks like ordinary metadata. Build examples using time-aligned feature snapshots. Future-derived aggregates can also expose information indirectly.
Fitted transformations belong inside the training boundary
Imputation values, selected features and scaling parameters can depend on the data used to fit them. In a validation fold, fit these values on the training partition and apply the resulting transformation to its held-out rows. Do the same for grouping and duplicate decisions. Training and test splits identify the roles of data partitions. Cross-validation repeats the entire pipeline rather than reusing transforms fit on all samples.[1][2]