MACHINE LEARNING / 6. SVM
Support Vector Machines
Maximum margin classifiers — geometry-driven learning
EXPLANATION
SVM finds the hyperplane that maximally separates classes. Instead of just finding any boundary, it finds the one with the largest margin — the distance to the nearest points from each class (support vectors). Hard margin SVM: assumes data is linearly separable. Rarely holds in practice. Soft margin SVM: allows some misclassifications (controlled by C): • High C → small margin, fewer errors on training data (overfit risk) • Low C → large margin, allows more training errors (underfit risk) Kernel trick: implicitly maps data to high-dimensional space where linear separation becomes possible, without computing the transformation explicitly. Common kernels: • Linear → dot product. Use for high-dimensional data (text) • RBF (Radial Basis Function) → most common, handles non-linear boundaries • Polynomial → for polynomial decision boundaries SVM works great for: text classification, image classification (before deep learning), small-to-medium datasets with clear margins.
DATA FLOW
Two classes (●, ○) in 2D:
● ● ○ ○
● ● | ○ ○
● |● ○|○
| ← decision boundary (hyperplane)
|←margin→|
| |
Support vectors: points on margin edges
Kernel trick: project to higher dim where linearly separable
(x1, x2) → (x1², √2·x1x2, x2²) ← polynomial kernelCODE