Quiz: SVMs for pixel classification

Short questions to test your understanding. Try each on paper first, then open the answer. The pixel classifier of the random forests day: paint strokes, compute a feature stack, train, look, correct; here with an SVM.


Q1. Why does an RBF SVM need standardised features while a random forest does not?

What does each method compute with the feature values?

The RBF kernel function depends on the distance between feature vectors, which is dominated by the features with the largest numbers; features with small ranges become invisible. A forest only compares one feature at a time with a threshold, and a threshold works the same in any units.


Q2. You standardise with the mean and standard deviation of all pixels of the image, including the held-out region you evaluate on. What is wrong with that?

Which data may influence the model?

The held-out pixels then influence the model (through \mu_j, s_j): information leaks from the evaluation data into training, and the measured error can be optimistic. Compute the statistics on the training pixels (in cross-validation: on the training folds) and apply them unchanged to everything else.


Q3. Cross-validation with folds by pixel reports 0% error; with folds by stroke 19%. Which do you report, and why do they differ?

Where are the neighbours of a held-out pixel?

By stroke. With folds by pixel, each held-out pixel’s neighbours (nearly identical, from the same stroke) are in training, so even memorising gets it right. With folds by stroke the held-out pixels come from strokes the SVM has not seen, as new parts of the image will be.


Q4. A cross-validation map over (C, \gamma) is worst in the corner with the largest C and \gamma. Explain.

Unit 3: what does an RBF SVM with large \gamma and large C do to the training points?

Large \gamma: each bump covers only its own training pixel; large C: no violation is tolerated. The SVM builds an island around every training pixel and calls everything else by the default value b: it memorises (zero training error) and fails on held-out strokes. Overfitting.


Q5. A one-vs-rest SVM gives a pixel f_1 = -0.5, f_2 = -0.2, f_3 = -0.9. Which class, and how sure is it?

How many classifiers claim the pixel?

Class 2 (the largest f), but none of the three SVMs claims the pixel: it lies in a region that each SVM assigns to “the rest”. The decision compares uncalibrated values and is unreliable; the pixel is a good place to paint.


Q6. How many SVMs does one-vs-one train for 4 classes? And one-vs-rest?

One per pair; one per class.

One-vs-one: 4 \cdot 3/2 = 6. One-vs-rest: 4.


Q7. Nuclei are only 5% of the painted pixels and the SVM misses many of them. Name two remedies that do not need more painting.

One changes the training, one the decision.

Class weights: a larger penalty C for nucleus violations (e.g. balancing weights n/(k\,n_c)). Or keep the SVM and lower the threshold on f for the nucleus class, trading precision for recall (an ROC curve shows the trade-off).


Q8. When would you choose an SVM over a random forest for pixels, and when a neural network?

How many labels, and where do the features come from?

An SVM: few labelled pixels and a good hand-made feature stack, when you are willing to standardise and cross-validate (C, \gamma); it is about as accurate as a forest there, but slower to predict and more work to tune. A neural network: many labelled images, when the features themselves should be learnt (the neural networks day). The forest remains the low-effort baseline.