- Introduced by
- Cortes, C. & Vapnik, V.
- Year
- 1995
- Type
- Maximum-margin classifier (kernel method)
What does it do?
The Support Vector Machine, introduced by Corinna Cortes and Vladimir Vapnik in their 1995 paper 'Support-Vector Networks', is a supervised classifier that seeks the separating hyperplane with the largest margin between two classes.
The boundary is determined by the support vectors: the training points on or inside the margin, or on the wrong side of it. Kernel functions extend the method to classes that no straight boundary can separate.
The intuition behind the method
Imagine separating two groups of points with a straight boundary. Many lines could do it, but SVM looks for the one positioned as far as possible from the closest points of each class, the widest 'street' between them. Only the support vectors actually shape the boundary. When the classes are perfectly separable these are the points closest to the street; when some overlap is tolerated, points inside the street or on the wrong side also become support vectors. Points lying well outside the margin on the correct side do not affect the boundary. When the classes cannot be split by a straight line, a kernel reshapes the space so that a separation becomes possible.
History
Corinna Cortes and Vladimir Vapnik introduced the Support Vector Machine in their 1995 paper 'Support-Vector Networks' (Machine Learning, 20). The paper combined the maximum-margin idea with kernel functions, so that classes with nonlinear boundaries could be handled within the same framework.
When to use it
Use SVM for classification on tabular data, particularly when the number of features is large and predictive accuracy matters more than explicit coefficients. The original method is binary; multi-class problems are handled through one-vs-rest or one-vs-one schemes, which the 1995 paper does not itself define. The method does not require normally distributed data, but the features must be standardised and the kernel, C and (for RBF) γ should be tuned by cross-validation. On very small samples the boundary becomes unstable and tuning is unreliable; there is no fixed cut-off, but a simpler classifier such as logistic regression or naive Bayes is usually more appropriate there, and also when the coefficients themselves must be interpreted.
Limitations and considerations
- Performance is sensitive to the choice of kernel, C and kernel parameters such as γ, all of which must be tuned by cross-validation.
- Requires careful feature standardisation, because unscaled features distort the distances on which the margin is based.
- Becomes unstable on small samples, where there are too few observations to define a reliable boundary and to tune the hyperparameters.
- Does not provide directly interpretable coefficients (in kernel form), and does not output class probabilities directly; probability estimates usually need an additional calibration step.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Effective in high-dimensional feature spaces, which is a common reason to apply it to problems with many predictors.
- The maximum-margin criterion, which depends only on the support vectors, tends to produce boundaries that are not dominated by the bulk of the training points far from the margin.
- Kernel functions allow nonlinear class boundaries to be modelled without manually engineering new features.
- Does not require the predictors to be normally distributed.
Applications
- Binary classification on tabular data, and multi-class classification through one-vs-rest or one-vs-one schemes.
- High-dimensional classification problems with many predictors.
- Prediction tasks where a robust, well-separated decision boundary matters more than interpretable coefficients, such as bankruptcy prediction, where an RBF-kernel SVM tuned by grid search and 5-fold cross-validation has been compared with logistic regression and discriminant analysis.
- Problems with nonlinear class boundaries, addressed through kernel functions.
How it works
How it works
SVM searches for the hyperplane that separates the classes with the largest margin, meaning the greatest distance to the nearest data points on either side. The support vectors alone determine where the boundary sits: points on the margin and, when violations are allowed, points inside it or on the wrong side. A wide margin is generally preferred over a boundary squeezed close to the training points, because it leaves more room between the classes for new observations. A new observation x is classified by the sign of the decision function f(x); in the kernel form, α_i is non-zero only for support vectors.
Formula
f(x)=\operatorname{sign}\big(w\cdot x+b\big),\quad \text{margin width}=\frac{2}{\lVert w\rVert}When the classes are not linearly separable, a kernel function K (for example the radial basis function, K(x, x') = exp(−γ‖x − x'‖²)) implicitly maps the features into a higher-dimensional space in which a separating hyperplane can exist. Because the margin is measured in feature space, the features should be standardised first (for example with StandardScaler). The kernel, the regularisation parameter C and, for the RBF kernel, the parameter γ are usually chosen together by grid search with k-fold cross-validation (for example 5-fold, as in published bankruptcy-prediction applications).
Formula
f(x)=\operatorname{sign}\Big(\sum_i \alpha_i y_i K(x_i,x)+b\Big),\quad K(x,x')=\exp\!\big(-\gamma\lVert x-x'\rVert^2\big)The boundary is found by minimising the objective above subject to the constraints y_i(w·x_i + b) ≥ 1 − ξ_i and ξ_i ≥ 0 for all i. Minimising the weight vector widens the margin, while a penalty C is paid for each point that falls on the wrong side of the margin or inside it (the slack variable ξ_i). A large C demands a tight fit to the training data; a small C tolerates more violations in exchange for a wider, smoother margin. With imbalanced classes, class_weight='balanced' prevents the minority class from being largely ignored.
Formula
\min_{w,b,\xi}\; \tfrac{1}{2}\lVert w\rVert^2 + C\sum_i \xi_i \quad \text{s.t.}\quad y_i(w\cdot x_i+b)\ge 1-\xi_i,\;\; \xi_i\ge 0Common pitfalls
- Fitting SVM on raw, unscaled features instead of standardising them first.
- Accepting default kernel, C and γ values rather than selecting them with cross-validation, for example by grid search.
- Ignoring class imbalance instead of setting class_weight='balanced'.
- Applying SVM to a very small sample, where the boundary is unstable and prone to overfitting.
- Reporting only accuracy without a confusion matrix, precision, recall, F1, and ROC-AUC.
Frequently asked questions
Why do I have to standardise the features?
SVM measures distances to the separating hyperplane, so features on larger numeric scales dominate the margin. Standardising every feature (StandardScaler) puts them on comparable scales so the boundary reflects the true class structure rather than arbitrary units.
What does the C parameter control?
C trades off margin width against classification errors. A large C forces a tight fit to the training data with a narrow margin; a small C allows more margin violations in exchange for a wider, smoother boundary. The right value is found by cross-validation.
What is the kernel for?
When the classes cannot be separated by a straight boundary, a kernel (such as the radial basis function) implicitly maps the data into a higher-dimensional space where a separating hyperplane exists, letting SVM model nonlinear boundaries. The kernel and its parameters (C, and γ for the RBF kernel) are typically tuned together by grid search with k-fold cross-validation.
When should I not use SVM?
On very small samples there are too few observations to define a stable boundary and to tune the kernel and C, so the model risks overfitting. There is no fixed cut-off, but in such cases a simpler classifier such as logistic regression or naive Bayes is preferable. SVM is also a poor choice when interpretable coefficients are required.
Related methods
Sources
Cortes, C. & Vapnik, V. (1995). Support-Vector Networks. Machine Learning, 20, 273–297.
Open DOI referenceMachine Learning with R Important Book, p. 130