Before you readOne unusual point forces a narrow margin. What if you let it step inside the strip?
Watch: Learning: Support Vector Machines · MIT OpenCourseWare · Watch the derivation for the dual; it starts from a hard margin.
The soft-margin SVM charges for crossing a margin edge rather than forbidding it. Write mi=yif(xi) for a point’s score signed by its true label. Its penalty, the hinge loss, is max(0,1−mi).
Hinge loss = 0.50
Move the signed score (horizontal axis). At m≥1 there is no loss. For 0<m<1 the prediction is right but inside the margin. At m=0 it is on the boundary; below 0 it is wrong.
The SVM minimises
21∥w∥2+Ci∑max(0,1−mi).
The first term favours a wide margin; the second charges for violations. With larger C, violations cost more. With smaller C, the model is more willing to let points enter the strip or even land on the wrong side. Equivalently, give each point slack ξi≥0, require mi≥1−ξi and charge Cξi. The cheapest slack is exactly the hinge loss.
The dual
Instead of solving directly for w, solve for one weight αi per training point. Maximise
i∑αi−21i,j∑αiαjyiyj(xiTxj)
subject to 0≤αi≤C and ∑iαiyi=0. The resulting direction is w=∑iαiyixi, so the prediction score is
f(x)=i∑αiyi(xiTx)+b.
Only points with αi>0 contribute; these are the support vectors. Both formulas use the input vectors only in dot products. That is what lets the next section change the features without writing them all out.
Recall
What changes when C increases in the soft-margin objective?
Recall
Which training points contribute to the dual prediction score?
Exercise
Three points have signed scores 1.2,0.4 and −0.5. What is their total hinge loss before multiplying by C?
Exercise
Two support vectors have labels +1,−1, weights α1=α2=0.5 and dot products x1Tx=3 and x2Tx=1 with a new point. With b=−0.5, find its score.