Support vector regression

Also known as: SVR

On this page 7

Support vector regression (SVR) is a supervised machine learning method that predicts continuous values by fitting a function that stays within a tolerance tube of width epsilon around the training targets while remaining as flat as possible. Errors smaller than epsilon cost nothing, and only points on or outside the tube, the support vectors, determine the final model.

SVR adapts the margin principle of the support vector machine from classification to regression. Combined with the kernel trick, it can model strongly nonlinear relationships while keeping a convex optimization problem with a single global optimum, which made it one of the most trusted regression tools in machine learning before gradient boosting became dominant on tabular data.

How the epsilon-insensitive loss works

SVR works by minimizing the epsilon-insensitive loss together with a penalty on model complexity. The loss is zero when the prediction lies within epsilon of the target and grows linearly with the distance beyond that band, so the model tolerates small noise but resists large deviations.

In the linear case, the model is f(x) = w · x + b. Training minimizes one half of the squared norm of w, which encourages a flat function, plus C times the sum of slack variables that measure how far each point lies outside the tube. The flatness term plays the role that regularization plays in ridge regression, while the slack term controls how strongly violations are punished.

The dual formulation expresses the solution as a weighted sum over training points. Points strictly inside the tube receive a weight of zero and drop out, so the trained model depends only on the support vectors. This sparsity is a defining property of SVR and distinguishes it from kernel ridge regression, where every training point contributes.

The table below contrasts the loss functions that regression methods commonly use.

Loss functionPenalty on residual rBehavior with outliers
Squared lossr squaredVery sensitive, large errors dominate
Absolute lossAbsolute value of rRobust, but every error counts
Epsilon-insensitive lossZero inside epsilon, linear outsideRobust and ignores small noise
Huber lossQuadratic near zero, linear far awayRobust with a smooth transition
Loss functions used in regression

Hyperparameters and kernels

The behavior of support vector regression is governed by three main hyperparameters: the regularization constant C, the tube width epsilon and the kernel parameters, most often gamma for the radial basis function kernel. They interact strongly, so they are usually tuned together with cross-validation.

HyperparameterTypical search rangeEffect when increased
C0.1 to 1,000 on a log scaleFits training data more tightly, higher variance
EpsilonAbout 1 to 10 percent of target spreadWider tube, fewer support vectors, smoother fit
Gamma (RBF)0.0001 to 10 on a log scaleMore local influence, wigglier function
Polynomial degree2 to 4More flexible curves, higher risk of overfitting
Main SVR hyperparameters

Kernels map inputs implicitly into a richer feature space. The linear kernel suits high-dimensional sparse data such as text features, the radial basis function kernel is the general-purpose default for smooth nonlinear relations, and polynomial kernels fit interactions of known order. A useful variant, nu-SVR, replaces epsilon with a parameter nu that bounds the fraction of support vectors, which is easier to set when the noise level is unknown.

Support vector regression sits between linear models and flexible nonparametric methods. Its closest relatives are kernel ridge regression and Gaussian process regression, which use the same kernels but different losses and assumptions.

MethodMain strengthMain weakness
Support vector regressionSparse, robust, strong on small datasetsScales poorly beyond tens of thousands of rows
Kernel ridge regressionClosed-form solution, simple to implementDense model, sensitive to outliers
Gaussian process regressionCalibrated uncertainty estimatesCubic training cost in sample size
Gradient boostingExcellent on large tabular dataMany hyperparameters, piecewise constant output
Ridge regressionFast and interpretableOnly linear relationships without manual features
SVR and neighboring regression methods

Unlike Gaussian processes, SVR provides no native predictive uncertainty. When intervals are required, practitioners add conformal prediction or switch to quantile regression or a probabilistic model.

When to choose support vector regression

SVR is the right choice when the dataset is small to medium, typically hundreds to a few tens of thousands of samples, the relationship is smooth but nonlinear and robustness to moderate noise matters. Typical domains include chemometrics, materials property prediction, sensor calibration and short-term load or price forecasting.

  • Scale every feature before training, because RBF and polynomial kernels depend on distances and dot products.
  • Set epsilon from the noise level, for example close to the known measurement error of the target.
  • Search C and gamma jointly on a logarithmic grid or with Bayesian optimization.
  • Scale the target when its values are very large or very small, so that epsilon has a sensible meaning.
  • Inspect the share of support vectors: values near 100 percent suggest epsilon is too small or the model is mis-specified.

Limitations and common mistakes

The main practical limitation of SVR is computational cost. Standard solvers scale roughly between quadratically and cubically with the number of samples and must store a large kernel matrix, so training on hundreds of thousands of rows becomes slow without approximations such as random Fourier features or the Nystroem method.

Common mistakes follow a recognizable pattern. Training on unscaled features lets a single large-valued variable dominate the kernel. Using default hyperparameters often produces a nearly constant prediction. Tuning on the test set causes data leakage and overly optimistic error estimates. Finally, the kernel model is hard to interpret, so feature importance must come from permutation methods rather than coefficients.

In plain words

Support vector regression draws a smooth curve through data points. Around that curve it lays a tube of a chosen width. Points inside the tube are good enough. The method does not try to fix them.

Only points outside the tube push the curve. Those points are called support vectors. The method also keeps the curve as calm and simple as possible. The result is a prediction that ignores small noise but still follows the real trend.

A real-world example

A pharmaceutical quality laboratory wants to estimate the active ingredient concentration of tablets from near-infrared spectra instead of running a slow chemical assay on every batch. The team has 420 reference samples, each with about 700 spectral variables and a measured concentration.

After standardizing the spectra and reducing them with principal component analysis, analysts train an SVR model with an RBF kernel. They set epsilon near the assay’s own measurement error of 0.3 percent and select C and gamma by five-fold cross-validation. About 35 percent of the samples end up as support vectors.

On an independent validation set, the model predicts concentration with a root mean squared error of about 0.5 percent, close to the reference method. The laboratory now screens every batch spectroscopically within seconds and sends only borderline results for full chemical analysis, which shortens release time by roughly a day per batch.