What is a support vector machine?
A support vector machine is a classic supervised learning model that learns the decision boundary separating classes with the widest margin and can draw non-linear boundaries through kernel functions.
It is also called an SVM. It differs from a random forest in how it forms the boundary: a random forest decides by the vote of many decision trees, while an SVM seeks one geometric boundary that maximises the gap between classes. It is used mainly for classification, with a variant for regression.
- Topic
- Machine learning, models and training
- Also known as
- SVM, support-vector network
- Origin
- 1995, Cortes and Vapnik
How a support vector machine works
- The model seeks the boundary between two classes with the largest distance, the margin, to the nearest examples.
- The examples closest to the boundary are the support vectors; only they set the boundary.
- The kernel trick maps examples implicitly into a higher-dimensional space, allowing non-linear boundaries to be learned.
- A soft margin setting lets some examples fall on the wrong side, preventing overfitting on noisy data.
In more detail
Why feature scaling matters
Because SVMs rely on distances and dot products, unscaled features with large numeric ranges dominate the decision boundary. Inputs are therefore standardised or normalised before training and the same scaler parameters are reused at inference.
The C and gamma hyperparameters
Two hyperparameters govern an RBF SVM: C (the soft-margin penalty trading margin width against training errors) and gamma (controlling how far a single training example's influence reaches). Poor tuning easily leads to underfitting or overfitting, so both are usually tuned with cross-validated search.
Linear and kernel SVMs: scale and multi-class use
Kernel SVMs, such as those with an RBF kernel, scale roughly between quadratically and cubically with sample count because of the kernel matrix, so they slow down on hundreds of thousands of rows. Linear SVMs scale linearly and stay fast on large sparse data such as TF-IDF text. With more than two classes, one-vs-rest or one-vs-one strategies are used.
Probability calibration and support vector regression
Standard SVMs output signed distances to the hyperplane rather than calibrated probabilities, so probability-based thresholds require post-hoc Platt scaling or isotonic regression. For regression tasks, support vector regression (SVR) uses an epsilon-insensitive tube that ignores errors smaller than epsilon.
Commonly confused terms
| Term | How it differs |
|---|---|
| Logistic regression | Logistic regression minimises log loss over all training points and outputs class probabilities directly, whereas an SVM uses hinge loss to maximise a geometric margin set only by the support vectors. |
Why a support vector machine matters for on-premises AI
SVMs are a strong, stable baseline for small and medium tabular or text datasets; trainable and runnable on a CPU without a GPU, they suit restricted hardware and air-gapped settings. Training time grows quickly on very large datasets, where gradient boosting or neural networks are preferred. An SVM trained on embedding vectors is also a cheap way to build a fast classifier on top of language model outputs.
An energy company trains an SVM on features derived from meter readings to flag accounts suspected of illegal use; the model runs on a CPU on the company's own server.
Common questions
Does a support vector machine only draw linear boundaries?
No. Kernel functions map examples implicitly into a higher-dimensional space, letting it learn non-linear boundaries.
Are SVMs still used today?
Yes, especially as a reliable baseline with little data and as light classifiers on embedding vectors. On very large data other methods usually take over.
Related terms
- Classification
- Random forest
- Supervised learning
- Regression
- Decision tree
- Feature engineering
- Text classification
Sources
In the glossary: Glossary, R to Z