Lesson 6.5 · 10 min read · about 55 min to master at a very slow pace

Margins and Support Vectors

The geometry of the margin: distance from a point to the boundary, the margin width 2/‖w‖, what support vectors are, and a complete SVM solved by hand.

Not startedJump to quiz

Geometry

  • The decision boundary is the hyperplane .
  • The two margin lines are and .
  • The distance from a point to the boundary is .
  • So the margin width (gap between the two margin lines) is . A wider margin means a smaller .
012345012345support vector (1, 1)support vector (3, 3)width 2.83
Boundary 0.5x₁ + 0.5x₂ − 2 = 0Margin f = +1Margin f = −1
Circled points sit exactly on the margin lines: they are the support vectors. Moving any other point (without crossing the margin) leaves the solution unchanged.

Support vectors

Support vectors are the training points lying exactly on the margin lines (and, in the soft-margin case, inside the margin or misclassified). They alone determine the solution: delete or move any other point, as long as it stays outside the margin, and the boundary doesn't change. That's why SVMs can be efficient and robust to points far from the boundary.

An SVM by hand

Negative support vector , positive support vector , other points further away. By symmetry, . Support vectors satisfy :

Subtract: , so and . Hence , .

, so margin width . Check: it equals the distance between the two support vectors, .

Classify : , so . Its distance to the boundary is . Because , it lies inside the margin.

Margin from a given

, : , margin width . Point : , class , distance , outside the margin since .

Cheatsheet

SVM geometry

Boundary ; margins . Distance . Width .

Support vectors

Points on (or inside) the margin. They alone determine the boundary.

SVM by hand (2 support vectors)

Use symmetry for the direction of ; set at the negative SV and at the positive SV; solve; width .

See every cheatsheet by category →

Check your understanding

Score 75% or more to master this lesson and earn XP. Answer first, then check.

Q1calculateAn SVM has and . What is the margin width?
Q2calculateSame SVM (, ). What is the distance of the point from the boundary, and its class?
Q3calculateThe positive support vector is and the negative one is , with . Find , and the margin width.
Q4conceptWhat happens if you delete a training point that is not a support vector?
Q5conceptWhy does minimising maximise the margin?