lesson 4 of 5 · bias, variance, and leakage in plain codelesson 4 of 5 · bias, variance, and leakage in plain codelesson 4 of 5 · bias, variance, and leakage in plain codelesson 4 of 5 · bias, variance, and leakage in plain codelesson 4 of 5 · bias, variance, and leakage in plain codelesson 4 of 5 · bias, variance, and leakage in plain codelesson 4 of 5 · bias, variance, and leakage in plain codelesson 4 of 5 · bias, variance, and leakage in plain codelesson 4 of 5 · bias, variance, and leakage in plain codelesson 4 of 5 · bias, variance, and leakage in plain codelesson 4 of 5 · bias, variance, and leakage in plain code
Checkpoint
One last thing before we move on. pass this to mark the lesson done, or skip and keep moving. hop to the next when you're ready.
Build the leakage hunter. For each feature (f1 and cheat), compute the gap: abs(mean among label-1 rows minus mean among label-0 rows), rounded to 2 places. Print features sorted by gap (largest first, one 'name gap' line each), then a 'suspicious:' line naming the biggest. A feature whose per-class means separate this cleanly is the label leaking through.