Lesson 6.4 · 7 min read · about 45 min to master at a very slow pace
SVM Fundamentals
A support vector machine is a linear classifier that chooses the separating line with the widest safety margin. The idea, the ±1 label convention, the decision rule, and the link to regularisation.
The idea: the widest street
For two classes labelled (note: not 0/1), a linear classifier computes a score and takes its sign:
If the classes can be separated by a line, infinitely many lines work. Which is best?
Why a wide margin?
A line squeezed against the training points could be tipped over by a little noise in new data. A line in the middle of a wide gap tolerates more. A wider margin means a simpler, more robust classifier: this is the link to regularisation.
How SVMs fit into the course
| Logistic regression | Linear SVM | |
|---|---|---|
| Labels | ||
| Loss | Cross-entropy | Hinge loss (6.6) |
| Output | A probability | A score / class only (probabilities need extra calibration) |
| Which points matter | All points | Only support vectors: points on or inside the margin |
| Regularisation | (ridge or LASSO) | (acts like ), L2 on |
| Nonlinear boundaries | Add features by hand | Kernels (6.7) |
| Needs standardised features | For penalties: yes | Yes |
Both are linear classifiers with a boundary . They differ in which line they choose, because they use different losses.
Cheatsheet
Logistic regression vs linear SVM
SVM decision rule
Check your understanding
Score 75% or more to master this lesson and earn XP. Answer first, then check.