Skip to content
BIASED

Support vector machines

Block 1 of 8~2 min

Which separating line

The topic Classification metrics taught us to judge a trained classifier. It does not say which classifier to train. When the classes in the training set are separable, infinitely many hyperplanes have zero training error, and every metric on the training set calls them perfect. The logistic loss sends the weights to infinity on such data (see Logistic regression). The hinge loss drops to zero once every margin is at least 11 and stops telling the solutions apart. The support vector machine (SVM) answers with geometry: take the hyperplane that stays as far as possible from the nearest training points.

Classes in this topic are y∈{−1,+1}y \in \{-1, +1\}. Recall two quantities from Linear classifiers and surrogate losses. The distance from a point xx to the hyperplane ⟨w,x⟩+b=0\langle w, x \rangle + b = 0 is

dist⁡(x)=∣⟨w,x⟩+b∣∥w∥,\operatorname{dist}(x) = \frac{\lvert \langle w, x \rangle + b \rvert}{\lVert w \rVert},

and the margin of an object is Mi=yi(⟨w,xi⟩+b)M_i = y_i(\langle w, x_i \rangle + b). It is positive when the object is classified correctly. For a hyperplane that classifies every point correctly, ∣⟨w,xi⟩+b∣=Mi\lvert \langle w, x_i \rangle + b \rvert = M_i. So the margin of the hyperplane, its distance to the nearest training point, is

γ=min⁡iMi∥w∥.\gamma = \min_i \frac{M_i}{\lVert w \rVert}.

The running example comes from the topic Duality of the course Mathematics for ML. The negative points are A=(0,0)A = (0, 0) and B=(2,0)B = (2, 0), the positive ones C=(1,2)C = (1, 2) and D=(3,3)D = (3, 3). The line x2=0.2x_2 = 0.2 separates them without errors, but passes 0.20.2 from AA and BB. The line x2=1x_2 = 1 makes no errors either, and its nearest points, AA, BB and CC, are at distance 11. A new negative object just above AA lands on the wrong side of the first line and on the right side of the second.

The SVM idea is to maximize γ\gamma. The intuition: a decision that does not change when every training point is nudged a little is less tuned to the accidents of the sample. The formal argument comes in the last block.

Answers are saved on the server and tied to this browser until you sign in.