when data are not linearly separable, the hard margin (requiring
yi(wTxi+b)≥1) is infeasible. The soft margin introduces slack variables
ξi≥0 allowing violations at a linear penalty:
minw,b,ξ21∥w∥2+C∑i=1nξi s.t.
yi(wTxi+b)≥1−ξi. Eliminating
ξi gives the equivalent unconstrained form
minw21∥w∥2+C∑imax(0,1−yif(xi)), where the hinge loss
max(0,1−yf(x)) is a convex upper bound on the
0-1 loss and has zero gradient once
yf(x)≥1. The hyperparameter
C trades margin width against misclassification penalty:
C→∞ recovers the hard margin (zero tolerance, overfits),
C→0 ignores mistakes (maximum margin, underfits).