1.4 — Geometric view: the separating hyperplane and the margin
Goal: Interpret a linear classifier geometrically: the decision boundary is a hyperplane, the weight vector is its normal, and the signed distance to the boundary is the margin.
1. Why this session exists
Every linear classifier — perceptron, logistic regression, SVM, the first layer of any neural net — predicts based on the sign of . Behind that sign is a single piece of geometry: a hyperplane that cuts into two half-spaces. This session unpacks that picture and defines the margin, the quantity that the perceptron's convergence proof (1.5) and the SVM's margin-maximisation objective (Chapter 3) both control.
2. Hyperplanes
A hyperplane in is the level set of an affine function:
It is a flat -dimensional affine subspace. The pair specifies it up to a nonzero scaling: if , then describes the same set. (Sign matters: flips which side is positive.)
is the normal vector to . For any two points ,
So is orthogonal to every direction within — it is the normal.
3. Signed distance to a hyperplane
For an arbitrary point , decompose
choosing as the foot of the perpendicular from to . Apply and add :
Solving for ,
This is the signed distance from to . Its sign tells which side lies on; its absolute value is the Euclidean distance. We will call
the distance function of the hyperplane.
4. The decision rule
A linear binary classifier predicts
with the convention (the measure-zero boundary case from 0.9 doesn't matter in practice). The two open half-spaces
are the decision regions. For logistic regression specifically, is equivalent to , so the decision boundary coincides with .
5. The margin of a dataset
Let with . (We switch to encoding here because it pairs cleanly with the sign rule and with 1.5.) The classifier correctly labels example iff
The geometric margin of on example is
Positive iff the example is correctly classified; magnitude = Euclidean distance from to the hyperplane.
The geometric margin on the dataset is
The maximum margin of the dataset is
If the dataset is linearly separable and measures by how much. This single number controls the perceptron's convergence speed (1.5) and is what SVMs maximise.
6. Why this matters
Three places the margin re-appears in the course.
- 1.5 (Novikoff's theorem). The number of perceptron updates is bounded by with .
- SVMs (Chapter 3). The hard-margin SVM is subject to all . The soft-margin version trades off margin against violations.
- Generalisation bounds. Large-margin classifiers generalise better; Rademacher and PAC-Bayes bounds tighten as grows. This is the formal version of the visual intuition that a wider gap separates classes more confidently.
7. Takeaways
- A linear classifier's decision boundary is a hyperplane .
- is the unit normal to ; is the signed offset from the origin along that normal.
- Signed distance from to : .
- Geometric margin on example : . Dataset margin . Maximum margin .
(a) Find the hyperplane in defined by , . Sketch it. Compute the signed distance from the origin and from .
(b) Show that the signed distance is invariant under the positive rescaling with , but flips sign under .
(c) For a dataset of two points , with labels , find the maximum-margin hyperplane and compute .
(d) Prove that if a dataset is linearly separable, the normalised parameters achieving the maximum margin satisfy for all . (This is the canonical normalisation used in the SVM formulation.)