Lesson 3 of 5 9 min · 103 words
Soft margins and hinge loss
Allowing violations, controlled by C.
Real data is rarely perfectly separable. The soft-margin SVM adds slack variables that let points violate the margin, at a cost:
Equivalently, it minimises the hinge loss plus an L2 penalty. Hinge loss is zero for points correctly classified beyond the margin and grows linearly otherwise.
controls the trade-off. Large C: violations are expensive → narrow margin, fits training data tightly, risk of overfitting. Small C: violations are cheap → wide margin, more training errors, smoother boundary. Choose C by cross-validation.
Formula to remember
RBF kernel
Similarity decaying with distance.
Quick check · +5 XP