Before you readSeveral lines separate two classes perfectly. Which one leaves the most room for a new point?
Watch: Support Vector Machines: Main Ideas · StatQuest with Josh Starmer
With labels y∈{−1,+1}, predict from the sign of f(x)=wTx+b. The boundary is where f(x)=0, and w points across it towards the positive side. The distance from a point to the boundary is ∣f(x)∣/∥w∥: divide by ∥w∥ to turn the score into a perpendicular distance.
A maximum-margin classifier puts the boundary in the middle of the widest empty strip between the classes. The points touching the strip are the support vectors. A point well outside the strip can move a little without changing the fit.
Strip width = 1.20
Slide the solid line. The shaded strip extends the same distance on both sides, stopping at the nearest point. At its widest, a square and a circle touch the two edges.
Multiplying w and b by the same positive number leaves the boundary unchanged. Choose the scale so the nearest points have yif(xi)=1. The two edges are then f(x)=±1: each is 1/∥w∥ from the boundary, so the full strip is 2/∥w∥ wide.
To make the strip widest, the hard-margin SVM minimises 21∥w∥2 subject to yif(xi)≥1 for every training point. Each constraint puts one point on the correct side and outside or on its margin edge. If no straight boundary separates the classes, these constraints cannot all hold.
Recall
Which points are the hard-margin support vectors?
Recall
What is the full width of the strip between f(x)=−1 and f(x)=+1?
Exercise
On a number line, the closest negative and positive points are x=−1 and x=3. Find the maximum-margin boundary coordinate and the full strip width, in that order.
Exercise
For w=(3,4)T and b=−2, how far is x=(2,0)T from the decision boundary?