Support Vector Machine (SVM)

A classical machine learning method often used for classification and sometimes regression.

Which samples determine the widest gap?

Place two classes on a single measured axis. Class A has values 1 and 2. Class B has 6 and 7. Any threshold between 2 and 6 separates the training examples, but some boundaries leave more room than others.

Candidate boundaryDistance to nearest ADistance to nearest B
313
422
531

Which examples support the boundary?

In this separable one-dimensional, hard-margin example, the widest minimum distance is two, achieved at 4. The closest points, 2 and 6, support that boundary. Moving either outer point farther away need not change it. In higher dimensions the corresponding boundary is a hyperplane.

Light and teal beads form two groups on a rail with a divider between them.
The closest examples constrain the position of a maximum-margin boundary.

What if the classes overlap?

A soft-margin SVM balances a large margin against penalties for violations. Feature scaling changes distances, and a kernel can represent a nonlinear boundary. Record the preprocessing and regularization choice when comparing models. A signed decision score also needs separate calibration before being read as a probability.

Follow the idea

Binary Classification · Place a separating boundary in a two-class task.

Regularization · See why fitting methods trade fit against complexity.

Source · Scikit-learn support vector machine guide

Return to Support Vector Machine (SVM) in the A–Z glossary