A split that reports a number about nothing
counterexample▲▲△The first assumption of this chapter is that examples are drawn independently from one fixed distribution. Construct a dataset where that fails, show concretely that the reported test accuracy is then not an estimate of anything the modeller wants, and state the smallest repair.
Hint
Independence is a property of the sampling, not of the numbers. Ask what happens when a single underlying object contributes several rows.
Solution
The construction. Take patients. From each, take photographs of the same skin lesion, from slightly different angles: images, each labelled benign or malignant according to that patient’s biopsy.
Split the images uniformly at random, for training and for testing.
Why the assumption fails. The ten images from one patient are not independent draws. They share a lesion, a camera, a skin tone, a lighting condition. Under a uniform split, a given patient’s images land on both sides: with training, the chance that a particular patient has all ten images in test is . In expectation, essentially every patient in the test set also appears in training.
What the model can do. Nothing about the disease needs to be learned. A model that recognises the patient — from a freckle, the skin tone, a background corner of the image — can recall that patient’s label from training and apply it to the test images. It will score near-perfectly.
Concretely: suppose the model learns patient identity with accuracy and nothing else. Test accuracy is then about , against a base rate of, say, . The reported number looks like a strong result.
What it is an estimate of. It estimates performance on new photographs of patients already seen. That is a real quantity, and it is almost never the one anyone wants. The quantity wanted is performance on a new patient, and the experiment contains no evidence about it whatsoever — a model with reported accuracy may be at chance on a new patient, and this design cannot distinguish the two cases.
The smallest repair. Split by patient, not by image. Assign each of the patients wholly to train or wholly to test. The test set then contains no patient the model has seen, and the number estimates the quantity of interest.
The cost is that the effective sample size falls from to , so the confidence interval widens by roughly (Confidence intervals 0.ST.02). That is not a loss — the narrow interval was never real. The honest number is the wider one.
The general form. Wherever rows share a latent generator — patient, site, author, session, scanner, document — independence fails, and the repair is always to split at the level of the generator. Chapter VIII.3 makes this quantitative; Proposition I.1.P05 is where it starts.