Skip to content
StackDecode
AI & ML Atlas
Machine LearningalgorithmInteractive simulation

Support Vector Machine (SVM)

Finds the boundary with the widest possible margin between classes.

The idea

Among all lines that separate two classes, the SVM picks the one farthest from the nearest points of each class. Those nearest points are the support vectors; only they define the boundary. A soft margin tolerates a few mistakes, and kernels let it draw curved boundaries by implicitly working in a higher-dimensional space.

minimise ½‖w‖² + C·Σ max(0, 1 − yᵢ(w·xᵢ + b))

Watch it run

This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.

  • class 0
  • class 1

All the data starts in one box. The tree will ask yes/no questions to separate the classes.

impurity:
0.5
1/4

Every cut is axis-aligned, so each region is a rectangle. Deeper trees carve finer boxes and can overfit.

Step by step

  1. 1Pick a boundary w·x + b = 0.
  2. 2Measure the margin, which is 2/‖w‖.
  3. 3Penalise points inside the margin or on the wrong side (hinge loss).
  4. 4Optimise w and b to maximise the margin with few violations.
  5. 5Classify by the sign of w·x + b.

Where it is used

Text classification, bioinformatics, medium-sized datasets.

Watch out for

Scales poorly to very large data and needs feature scaling; C and the kernel need tuning.

Related