Skip to content
Discussion options

You must be logged in to vote
Admin verified this answer by martex-dev Aug 27, 2026

Fitting the preprocessing on the whole dataset before splitting. A StandardScaler fitted before the split has already seen the test period's mean and variance. The structural fix is to put every transform inside a pipeline object so it is refit on each training fold, which makes the leak impossible rather than merely unlikely.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer verified by Admin Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant