Feature Engineering & Data Leakage
9 min read.
Amazon had over two million brands in 2019, and three obvious encodings each fail one step later. Watch the hashing trick absorb an unbounded category space, then toggle scale-before-split to see a statistic carry the test set into training.
Think of it this way: A recipe where the ingredients matter more than the technique. And where one of the ingredients is a taste of the finished dish, which makes every practice run go beautifully and tells you nothing about dinner.
Missing not at random
Missing because of the true value itself. Respondents who did not disclose income tend to have higher income than those who did.
Removing these rows removes information — the fact that income is missing is itself a signal.
Check your understanding
Answer from memory before you scroll back up. Pulling an idea out of your head is what makes it stay there.
Leak or safe?
Sort each practice by whether it leaks information from the test set into training.
Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.
Leaks
Drop items hereSafe
Drop items hereQuiz
20 questionsIncome missing because high earners decline to disclose it is an example of:
Done with this lesson?
Sign in free to keep your progress, streak and quiz scores.