Data leakage

Data leakage occurs when information that is absent at prediction time, or that comes from the test set, influences training. It inflates scores in a misleading way. Examples: standardizing before the split, or using as a feature a variable computed from the target.

Example

scaler.fit(X)  # error: the scaler also sees the test set

Related concepts

The whole glossary