support vector machine (SVM)
A support vector machine (SVM) is a classification model that separates two groups of data points with the boundary that leaves the widest possible gap between them. That gap is called the margin. The training points closest to the boundary, known as support vectors, are the only ones that decide where it lies.
SVMs are a classic supervised learning method. With many features, the boundary is a hyperplane, the higher-dimensional version of a line drawn between points on a flat plot. Real data rarely splits cleanly, so the soft-margin form lets some points sit inside the margin or on the wrong side at a cost.
A regularization hyperparameter, called C in scikit-learn, sets that cost. A low value gives a smoother boundary that tolerates more mistakes, while a high value tries to classify every training example correctly and risks overfitting.
In the plot below, sliding C retrains a linear SVM on the same points and redraws its boundary, margin, and ringed support vectors:
When no straight boundary can separate the classes, the kernel trick scores how similar two points are as if they had been mapped into a higher-dimensional space, without ever building that space. A flat boundary found there curves when it’s projected back onto the original features. The common kernels are:
- Linear: Keeps the original features, which suits high-dimensional sparse data such as text
- Polynomial: Adds interactions between features up to a chosen degree
- Radial basis function (RBF): Scores similarity by the distance between points, and is the default in scikit-learn’s
SVC
Bernhard Boser, Isabelle Guyon, and Vladimir Vapnik combined kernels with maximum-margin classifiers in 1992. Corinna Cortes and Vapnik added the soft margin in a 1995 paper. The basic model handles two classes, so multiclass problems get split into several two-class ones.
An SVM outputs a signed distance from the boundary rather than a probability. Getting probabilities takes an extra calibration step, such as fitting a logistic regression on the SVM’s scores. Kernel SVMs also need features on comparable scales, and their training time grows somewhere between the square and the cube of the number of samples.
SVMs were a standard choice for text classification before neural networks took over. In LLM work, they mostly show up as a lightweight classifier trained on top of embeddings, such as a linear SVM that routes support tickets by topic.
Related Resources
Tutorial
Logistic Regression in Python
In this step-by-step tutorial, you'll get started with logistic regression in Python. Classification is one of the most important areas of machine learning, and logistic regression is one of its basic methods. You'll learn how to create, evaluate, and apply a model to make predictions.
For additional information on related topics, take a look at the following resources:
- Split Your Dataset With scikit-learn's train_test_split() (Tutorial)
- Practical Text Classification With Python and Keras (Tutorial)
- Learn Text Classification With Python and Keras (Course)
- Splitting Datasets With scikit-learn and train_test_split() (Course)
- Split Your Dataset With scikit-learn's train_test_split() (Quiz)
Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.
By Martin Breuss • Updated Nov. 15, 2026