Skip to content

Classification Overview

Chapter 9 predicted a real number. Chapter 10 found a compact representation. Chapter 11 estimated a density. Chapter 12 predicts one of two labels — the last of the book’s four pillars — and it does so with no probability anywhere in it.

f:RD{+1,1}(12.1)f : \mathbb{R}^D \to \{+1, -1\} \qquad \text{(12.1)}

The book gives two reasons for choosing the SVM to carry this chapter. First, “the SVM allows for a geometric way to think about supervised machine learning” — it reasons about inner products and projections rather than likelihoods, which makes it the counterpart of Chapter 10 rather than of Chapter 9. Second, “the optimization problem for SVM does not admit an analytic solution so that we need to resort to a variety of optimization tools introduced in Chapter 7.”

§12.2.1§12.2.2§12.3.1§12.3.2
the question askedhow far is the closest point?same, with the scale fixed differentlywhat do the Lagrange multipliers say?which two points of the two hulls are closest?
what is optimisedmaxr\max rmin12w2\min\tfrac12\lVert\mathbf{w}\rVert^2min\min over α\boldsymbol\alphamincd\min\lVert\mathbf{c}-\mathbf{d}\rVert
variablesD+2D+2D+1D+1NNNN
convexnoyesyesyes

They are not four methods that happen to agree. Measured across 300300 random datasets, the first two return hyperplanes whose normals differ by at most 7.492×1067.492\times10^{-6} degrees. The fourth, converted through a formula the book does not state, matches a primal solve to 9.185×1089.185\times10^{-8}.

The conversion is worth having, because §12.3.2 leaves it out:

w=2(cd)cd2,r=cd2\mathbf{w}^* = \frac{2(\mathbf{c}-\mathbf{d})}{\lVert\mathbf{c}-\mathbf{d}\rVert^2}, \qquad r = \frac{\lVert\mathbf{c}-\mathbf{d}\rVert}{2}

The margin is half the distance between the two convex hulls. That is the shortest true statement of what an SVM computes, and it appears nowhere in the chapter.

The hinge loss reaches exactly zero:

(t)=max{0, 1t},t=yf(x)(12.28)\ell(t) = \max\{0,\ 1 - t\}, \qquad t = y f(\mathbf{x}) \qquad \text{(12.28)}

An example beyond its margin contributes nothing. Not a small amount — nothing. Four consequences, each measured on a different page:

consequencewheremeasured
a distant correct point cannot move the fit1205boundary at 2.0000002.000000 with the outlier at 66, 2020 or 8080
most multipliers are zero120633 of 88 examples carry the answer
deleting the rest changes nothing1206adding 500500 more changes nothing either — 8.289×10128.289\times10^{-12} of mass
the support vector count bounds leave-one-out error121022 of 6060 gives a guarantee of 0.03330.0333

Contrast the logistic loss, which the book names as the maximum-likelihood counterpart in §12.6: it is 0.0000450.000045 at t=10t = 10 and never zero. Every example keeps a gradient forever, so logistic regression has no support vectors — measured, deleting the SVM’s ignored examples leaves the SVM bit-for-bit identical and moves logistic regression’s offset by 0.5371670.537167.

Zero training error does not pick a classifier. 9,6289{,}628 sampled hyperplanes separate the eight running-example points perfectly, and their held-out accuracy spans 0.11190.1119. Something has to break the tie, and the margin is what §12.2 proposes.

But the margin raises the floor, not the ceiling. Binned by margin, the worst held-out accuracy climbs from 0.87570.8757 to 0.97770.9777 while the best barely moves. Across 192192 datasets the max-margin solution averages the 8484th percentile among separators that fit equally well — and beats all of them on only 66. It gives up 0.008190.00819 on average against the best that existed. Maximising the margin is insurance, not optimisation, which is what the generalisation bounds the book cites actually prove.

Equation 12.10 is not a convex problem, and the book presents Theorem 12.1 as an equivalence rather than an upgrade. The constraint w=1\lVert\mathbf{w}\rVert = 1 is a sphere; measured, a local solver fails on 12.55%12.55\% of random starts, against 0.00%0.00\% for Equation 12.21.

Leaving bb out of the regulariser is not a technical inconvenience. The book calls it a complication for theory and efficiency. It is what makes the answer independent of where the origin sits: shifting the data by (10,0)(10, 0) leaves the optimal value unchanged to 1.993×10151.993\times10^{-15}, while penalising bb changes it by 10.48\mathbf{10.48}.

“Infinite-dimensional feature space” has a measurable consequence. A feature map of dimension MM gives a Gram matrix of rank at most MM. Polynomial kernels saturate exactly — 66, 1010, 2121 at every NN from 5050 to 800800 — and the RBF’s never levels off, climbing from 5050 to 171171. That is what having no finite feature map looks like from outside.

The chapter never mentions standardising, and it is worth a quarter of a point of accuracy. Scaling one feature by ss and refitting is the same as minimising w12+w22/s2w_1^2 + w_2^2/s^2 under the original constraints — so the units decide how expensive each feature is to use. On data where the cheap feature is the bad one, held-out accuracy swings by 0.26380.2638. Standardising first collapses the spread to 0.00290.0029.

#pagebook sectionthe measured claim
1201Separating Hyperplanes§12.19,6289{,}628 perfect classifiers, accuracy spanning 0.11190.1119
1202The Concept of the Margin§12.2.1Equation 12.10 is non-convex; 12.55%12.55\% of solves fail
1203Why the Margin Can Be Set to One§12.2.2–12.2.3Theorem 12.1 to 7.492×1067.492\times10^{-6} degrees
1204The Soft Margin SVM§12.2.4unregularised bb buys translation invariance, 10.4810.48
1205The Hinge Loss§12.2.5a distant correct point moves the squared-loss boundary 2.333.972.33 \to 3.97
1206The Dual Support Vector Machine§12.3.1nαn=w2\sum_n\alpha_n = \lVert\mathbf{w}\rVert^2, an identity the book omits
1207The Convex Hull View§12.3.2the margin is half the distance between the hulls
1208Kernels§12.4polynomial Gram rank saturates at 66, 1010, 2121; the RBF’s never does
1209Numerical Solution§12.5a generic solver is 49,54849{,}548 times slower at N=2000N = 2000
1210Chapter 12 Worked Problems§12.6eight problems, this module’s own
1211Chapter 12 Formula Sheetevery equation and every measured constant

Neither changes anything that follows, but both are worth knowing about while reading.

Equations 12.5, 12.6 and 12.7 are not quite equivalent. Equation 12.6 is strict and 12.7 is not, so a point sitting exactly on the hyperplane satisfies 12.7 and violates 12.6. The disagreement is confined to a set of measure zero — and page 1204 found a case where it matters numerically, with an optimal boundary running exactly through two training points whose labels are then decided by a quantity of size 101510^{-15}.

§12.3.1’s margin note runs only one way. It says examples on the margin are those with 0<αi<C0 < \alpha_i < C. The KKT conditions give that implication, not its converse: αn=C\alpha_n = C permits ynf(xn)=1y_nf(\mathbf{x}_n) = 1 too, and at C=2C = 2 on the running example three on-margin examples sit exactly at the bound. The optimum there is unique, so it is not a solver artefact.

There is also a third, smaller one: §12.3.1’s fallback rule for recovering bb takes a median of absolute differences, which discards the sign and returns +2+2 where the answer is 2-2.

What the chapter assumes, and what it costs

Section titled “What the chapter assumes, and what it costs”

§12.6 is a page of pointers. Page 1210 runs the ones that can be run:

what the chapter says or omitsmeasured
“a classifier with large margin turns out to generalize well”true as a percentile — 84.11%84.11\% — and false as an optimum
CC is introduced and never chosenits good plateau is four orders of magnitude wide
kernel parameters “chosen using nested cross-validation”CC and γ\gamma do not tune independently: γ=0.01\gamma = 0.01 runs 0.71430.99650.7143 \to 0.9965 across CC
“does not naturally lend itself to a probabilistic interpretation”74.40%74.40\% of its scores fall outside [1,1][-1, 1]
Platt scaling as the repaircosts accuracy in the probabilities: Brier 0.096950.09695 against logistic regression’s 0.095400.09540
(never mentioned) feature scalingworth 0.26380.2638 of held-out accuracy
(never mentioned) class balanceat 1010 positives against 200200 negatives, recall on the minority is exactly 0.00000.0000
§12.6’s pointerand where it already appeared
logistic regression — the maximum-likelihood counterpartpage 1205’s loss table; page 1210’s measurement that it has no support vectors
Platt scaling and class probability estimationpage 1210, measured against a known true posterior
kernel methods more broadlypage 1208, and Chapter 10’s §10.5 where the same N×NN\times N matrix appeared
the Legendre–Fenchel transform as another route to the dualChapter 7’s §7.3.3
empirical risk minimisation and the theory behind the marginChapter 8’s §8.2
Gaussian process classification — a latent function priorChapter 9’s §9.3, and Chapter 11’s latent variables

And that closes the four pillars: regression in Chapter 9, dimensionality reduction in Chapter 10, density estimation in Chapter 11, classification here.

  • Chapter 12 is the last of the four pillars, classification, and it reasons geometrically rather than probabilistically.
  • It prints no numbers at all — no worked examples anywhere — so every value in this module is its own, checked against an eight-point running example whose answer is exact.
  • One classifier is reached four ways, and they agree to seven millionths of a degree across three hundred random datasets.
  • Only one of those four formulations is convex. The unit-sphere constraint of Equation 12.10 makes a local solver fail on one start in eight, while the squared-norm form never fails.
  • Zero training error does not pick a classifier, and the margin is what breaks the tie.
  • But the margin raises the floor rather than the ceiling. It lands at the 84th percentile every time and is almost never the best separator available.
  • The hinge loss reaches exactly zero, and everything distinctive about the method follows: distant points cannot move the fit, most multipliers are zero, deleting them changes nothing, and the support vector count bounds the leave-one-out error.
  • The logistic loss never reaches zero, which is why logistic regression has no support vectors and every example influences it forever.
  • The dual’s size depends on the number of examples and never on the number of features, which is the only reason an infinite-dimensional feature map is usable.
  • An infinite-dimensional feature space is measurable as a Gram rank that never saturates — polynomial kernels stop at 6, 10 and 21, and the RBF keeps climbing.
  • Read geometrically, the whole method is: find the two closest points of the two convex hulls and bisect the segment, and the margin is half its length.
  • Leaving the intercept out of the regulariser is what makes the answer independent of the coordinate system, which the book mentions only as a complication.
  • The chapter never mentions standardising, and a change of units on one feature is worth a quarter of a point of held-out accuracy.

Start here: Separating Hyperplanes

pch.coffeeTagline

pch.coffeeCta

pch.feedbackHeading

pch.feedbackSubheading