Support vector machines

Machine Learning · Combining and reshaping the simple models · 01 / 03 · Intermediate · 31 min

Finding the maximum-margin hyperplane separating classes, the kernel trick for non-linear data, and the C hyperparameter controlling the tradeoff.

Before thisK-nearest neighborsRegularization

Luis Serrano Academy · 31 min

Support vector machines

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by Luis Serrano AcademyReport a problem with this video

What you'll learn

  • A support vector machine finds the dividing line (or hyperplane) between two classes that maximizes the margin — the distance to the nearest point of either class — rather than just any line that separates them.
  • Only the points closest to that boundary, the support vectors, actually determine where it sits; every other point could move or vanish without changing the result at all.
  • The kernel trick lets a support vector machine separate data that is not linearly separable in its original space, by implicitly working in a higher-dimensional space where a straight boundary does exist.

Not just any separating line

Given two classes that can be separated by a straight line, there are infinitely many lines that would do the job. A support vector machine does not settle for any of them — it finds the one that maximizes the margin, the distance from the boundary to the closest point of either class. The intuition for why this specific choice matters: a boundary squeezed tight against the training data has almost no room for error on a new point that falls slightly differently than the training examples did, while a boundary with the widest possible margin has the most buffer before a new point near the edge gets misclassified.

Support vectors: only the closest points matter

The points that sit exactly on the margin’s edge are called support vectors, and they are the only points that actually determine where the boundary sits. Every other point in the training set — anything further from the boundary than the support vectors — could be moved, or removed entirely, without changing the fitted boundary at all. This is a genuinely distinctive property among the models in this roadmap: most models are influenced by every training point to some degree, while a support vector machine’s decision boundary depends on only a small subset of them.

What to watch for

The video is the only candidate that builds margin maximisation and the kernel trick together in one connected narrative, which matters because this lesson needs both — most other treatments of this topic, including the otherwise excellent StatQuest series linked as a deeper option, split the two halves across separate videos. At roughly thirty minutes it runs longer than most lessons in this roadmap, which is the direct cost of covering both halves properly in one place rather than the usual ten to twenty minutes.

The C parameter: how strict is the margin

Real data is rarely perfectly separable, and forcing a hard boundary with zero misclassifications on noisy data usually produces a narrow, fragile margin chasing a handful of difficult points. The C parameter controls this tradeoff directly: a large C penalizes any misclassified training point heavily, producing a narrower margin that fits the training data closely; a small C tolerates more misclassified points in exchange for a wider, more robust margin. This is conceptually the same bias-variance tradeoff that runs through regularization — C is, in effect, a support vector machine’s own regularization strength, and it needs to be chosen the same way, by checking performance on held-out data rather than guessed.

The kernel trick: separating what a straight line cannot

Some datasets have no straight boundary that separates their classes at all — imagine one class forming a ring around the other. The kernel trick handles this by implicitly mapping the data into a higher-dimensional space where a flat boundary does exist, without ever explicitly computing the coordinates of that higher-dimensional space, which would often be prohibitively expensive. A polynomial kernel and a radial basis function (RBF) kernel are the two most common choices, each defining a different notion of similarity between points under the hood — mechanically, a kernel is a function that computes what the dot product between two points would be in that higher-dimensional space, directly from their original coordinates, which is the mathematical sleight of hand that makes the whole trick computationally feasible.

Check yourself

  1. 01Why does a support vector machine prefer the boundary with the maximum margin rather than any boundary that separates the classes?

    A boundary with a wide margin generalizes better to new points near the edge of either class, because it has the most room for error before misclassifying something close to the training examples. A boundary that barely separates the training data is fragile to small shifts in new data.

  2. 02What does the kernel trick actually let the model do that a plain linear boundary cannot?

    Some datasets have no straight line or flat hyperplane that separates the classes in their original features. A kernel implicitly maps the data into a higher-dimensional space where such a straight separation does exist, without ever explicitly computing the coordinates in that higher-dimensional space.

Go deeper

The maths underneath

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark