Besley’s Lab
← All labs

Interactive notebook

SVM & the Kernel Trick

Why the widest street between classes generalizes — and how kernels make one exist.

Use the arrow keys to move the crosshair. Press Enter or Space to add a point or select the nearest point. Arrow keys move a selected point. Delete removes it; Escape releases it. Hold Shift with an arrow key for a larger move.
Add points as:
margin width 3.091support vectors 4misclassified 0
  • Class A
  • Class B
  • Margin

Drag a circled point — those are the support vectors. Move one and the boundary follows; move any other point and nothing happens at all. The plot also supports arrow-key editing.

The SVM doesn’t just find a separating line, it finds the one with the widest empty street between the classes. Only the points touching that street matter — everything else could be deleted without changing the answer. Lowering C makes the model tolerate violations in exchange for a wider margin; raising it forces a tighter fit around awkward points.