Quiz: honest validation
Before this unit: Boundaries, counts and the uncertain ground truth (previous unit); Pixel classification with a forest (day 33); Day 12: Thresholding; Day 33: Random forests; Day 36: Neural networks.
See also: Day 14: Labelling; Day 15: Watershed.
Short questions to test your understanding. Try each on paper first, then open the answer.
Q1. A pixel classifier is trained on 75 % of the pixels of 10 images, chosen at random, and tested on the other 25 %. It scores 98 %. Why is this number not to be trusted?
Where is the nearest training pixel of a test pixel?
Every test pixel has training pixels right next to it, with almost the same features and the same label: the classifier can score well by remembering its neighbours, without generalising. The score says little about new images. Split by image (or by experiment or day).
Q2. The method will be used on images from future experiments in your lab. At which level should you split, and why not at a lower level?
The test set must be as new as the data you will work on.
By experiment (leave one or more experiments out). Images from one experiment share the staining, the cells, the day’s microscope settings; a test on held-out images of the same experiments is easier than the real use and gives an optimistic number.
Q3. You rotate and flip every image to get 8 times more data, then split the images at random into training and test. What goes wrong? What is the correct order?
Where do the copies of a test image end up?
Rotated copies of a test image end up in the training set, so the classifier has seen the test images (in rotated form). Split first, then augment only the training images.
Q4. You have one large whole-slide image. Why do random square tiles as test set leak, and what helps?
What is next to the edge of a test tile?
Pixels at the edge of a test tile have training pixels right across the edge: near copies. Use larger blocks (or stripes), and a buffer zone around test blocks, wider than the correlation length (structure size plus feature smoothing), that is used for neither training nor testing. It still says nothing about other slides.
Q5. You tried 40 post-processing settings and report the best test Dice. Why is it optimistic even if all 40 settings are equally good?
Each test score has some random error.
Each test score is the true value plus noise; the maximum of 40 noisy numbers lies above their common true value (about 2.1 standard errors above it for 40). You report the luckiest one. Choose on a validation set and report the test score of the chosen setting once.
Q6. A method scores 0.93 on held-out images and 0.81 on held-out days. What does the difference measure, and which number would a user care about?
What changes between days?
The drop measures the domain shift between days (staining, illumination, focus, cell state): how much the method relies on conditions of the days it was trained on. A user applies it to new days, so 0.81 is the relevant number.
Q7. Why does a larger test set reduce the optimism of picking the best of many settings, but never remove it?
How does the noise of one score depend on n?
The optimism is about (noise of one score) × (a factor that grows slowly with the number of settings). The noise shrinks like 1/\sqrt n, so a larger test set reduces the optimism, but as long as the test set is used for the choice, the chosen score still contains the luck of being chosen. Only an independent test set removes it.
Q8. (math) For two settings with equal true accuracy and independent normal errors of SD \sigma, what is the expected optimism of reporting the better one?
E[\max(Z_1, Z_2)] for standard normals.
\sigma\,E[\max(Z_1, Z_2)] = \sigma/\sqrt\pi \approx 0.56\,\sigma: \max(a, b) = \frac{a+b}{2} + \frac{|a-b|}{2}, and E|Z_1 - Z_2| = 2/\sqrt\pi.