Open Agent School · Public worked example
Data Leakage: meaning and example
Welcome! Take one idea with you today.
Data leakage occurs when model development uses information that would not be available for the intended prediction. It includes future outcomes inside features, related or duplicate examples across splits, and preprocessing fitted using evaluation data. Leakage can make an ordinary model look astonishingly capable.
Picture it: A synthetic support table predicts whether a refund will be approved when a request arrives. It includes a "refund completed" field written three days later. The model looks nearly perfect. A second leak appears when repeated copies of the same ticket land in both training and test.
What is easy to mix up?
Target proxies, future timestamps, duplicate entities, and preprocessing fitted on the full dataset can still expose evaluation information. Audit the whole pipeline, not just column names.
Teaching example by Open Agent School. Source: scikit-learn - Common pitfalls: data leakage.