Lots of lines can separate two classes of points. SVM asks a sharper question: which line leaves the widest gap? That "widest street" idea makes it one of the most elegant classifiers in ML.
📐 Play with it (click to add points, drag C): https://dev48v.infy.uk/ml/day12-svm.html
The margin
SVM finds the boundary that maximizes the distance to the nearest points of each class. Only those nearest points — the support vectors — matter. Move any other point and the line doesn't budge.
Soft margin (C)
Real data overlaps. The C knob trades off a wide street vs. misclassifying a few points: low C = wide and forgiving; high C = tight, tries to get everyone right.
The kernel trick
A straight line can't separate a ring inside a ring — until you bend the space. The RBF kernel measures similarity by distance, letting a curved boundary appear without ever leaving 2D in your head.
🔨 Built from scratch (hinge loss → gradient descent → boundary + margin + support vectors) with a live demo: https://dev48v.infy.uk/ml/day12-svm.html
Part of MachineLearningFromZero. 🌐 https://dev48v.infy.uk
Top comments (0)