This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Understanding Support Vector Machine Regression

Mathematical Formulation of SVM Regression

Overview

Support vector machine (SVM) analysis is a popular machine learning tool for classification and regression, first identified by Vladimir Vapnik and his colleagues in 1992[5]. SVM regression is considered a nonparametric technique because it relies on kernel functions.

Statistics and Machine Learning Toolbox™ implements linear epsilon-insensitive SVM (ε-SVM) regression, which is also known as L1 loss. In ε-SVM regression, the set of training data includes predictor variables and observed response values. The goal is to find a function f(x) that deviates from yn by a value no greater than ε for each training point x, and at the same time is as flat as possible.

Linear SVM Regression: Primal Formula

Suppose we have a set of training data where xn is a multivariate set of N observations with observed response values yn.

To find the linear function

f(x)=xβ+b,

and ensure that it is as flat as possible, find f(x) with the minimal norm value (ββ). This is formulated as a convex optimization problem to minimize

J(β)=12ββ

subject to all residuals having a value less than ε; or, in equation form:

n:|yn(xnβ+b)|ε.

It is possible that no such function f(x) exists to satisfy these constraints for all points. To deal with otherwise infeasible constraints, introduce slack variables ξn and ξ*n for each point. This approach is similar to the “soft margin” concept in SVM classification, because the slack variables allow regression errors to exist up to the value of ξn and ξ*n, yet still satisfy the required conditions.

Including slack variables leads to the objective function, also known as the primal formula[5]:

J(β)=12ββ+Cn=1N(ξn+ξn*),

subject to:

n:yn(xnβ+b)ε+ξnn:(xnβ+b)ynε+ξn*n:ξn*0n:ξn0.

The constant C is the box constraint, a positive numeric value that controls the penalty imposed on observations that lie outside the epsilon margin (ε) and helps to prevent overfitting (regularization). This value determines the trade-off between the flatness of f(x) and the amount up to which deviations larger than ε are tolerated.

The linear ε-insensitive loss function ignores errors that are within ε distance of the observed value by treating them as equal to zero. The loss is measured based on the distance between observed value y and the ε boundary. This is formally described by

Lε={0if |yf(x)|ε|yf(x)|εotherwise

Linear SVM Regression: Dual Formula

The optimization problem previously described is computationally simpler to solve in its Lagrange dual formulation. The solution to the dual problem provides a lower bound to the solution of the primal (minimization) problem. The optimal values of the primal and dual problems need not be equal, and the difference is called the “duality gap.” But when the problem is convex and satisfies a constraint qualification condition, the value of the optimal solution to the primal problem is given by the solution of the dual problem.

To obtain the dual formula, construct a Lagrangian function from the primal function by introducing nonnegative multipliers αn and α*n for each observation xn. This leads to the dual formula, where we minimize

L(α)=12i=1Nj=1N(αiαi*)(αjαj*)xixj+εi=1N(αi+αi*)+i=1Nyi(αi*αi)

subject to the constraints

n=1N(αnαn*)=0n:0αnCn:0αn*C.

The β parameter can be completely described as a linear combination of the training observations using the equation

β=n=1N(αnαn*)xn.

The function used to predict new values depends only on the support vectors:

f(x)=n=1N(αnαn*)(xnx)+b.(1)

The Karush-Kuhn-Tucker (KKT) complementarity conditions are optimization constraints required to obtain optimal solutions. For linear SVM regression, these conditions are

n:αn(ε+ξnyn+xnβ+b)=0n:αn*(ε+ξn*+ynxnβb)=0n:ξn(Cαn)=0n:ξn*(Cαn*)=0.

These conditions indicate that all observations strictly inside the epsilon tube have Lagrange multipliers αn = 0 and αn* = 0. If either αn or αn* is not zero, then the corresponding observation is called a support vector.

The property Alpha of a trained SVM model stores the difference between two Lagrange multipliers of support vectors, αnαn*. The properties SupportVectors and Bias store xn and b, respectively.

Nonlinear SVM Regression: Primal Formula

Some regression problems cannot adequately be described using a linear model. In such a case, the Lagrange dual formulation allows the previously-described technique to be extended to nonlinear functions.

Obtain a nonlinear SVM regression model by replacing the dot product x1x2 with a nonlinear kernel function G(x1,x2) = <φ(x1),φ(x2)>, where φ(x) is a transformation that maps x to a high-dimensional space. Statistics and Machine Learning Toolbox provides the following built-in semidefinite kernel functions.

Kernel NameKernel Function
Linear (dot product)G(xj,xk)=xjxk
GaussianG(xj,xk)=exp(xjxk2)
PolynomialG(xj,xk)=(1+xjxk)q, where q is in the set {2,3,...}.

The Gram matrix is an n-by-n matrix that contains elements gi,j = G(xi,xj). Each element gi,j is equal to the inner product of the predictors as transformed by φ. However, we do not need to know φ, because we can use the kernel function to generate Gram matrix directly. Using this method, nonlinear SVM finds the optimal function f(x) in the transformed predictor space.

Nonlinear SVM Regression: Dual Formula

The dual formula for nonlinear SVM regression replaces the inner product of the predictors (xixj) with the corresponding element of the Gram matrix (gi,j).

Nonlinear SVM regression finds the coefficients that minimize

L(α)=12i=1Nj=1N(αiαi*)(αjαj*)G(xi,xj)+εi=1N(αi+αi*)i=1Nyi(αiαi*)

subject to

n=1N(αnαn*)=0n:0αnCn:0αn*C.

The function used to predict new values is equal to

f(x)=n=1N(αnαn*)G(xn,x)+b.(2)

The KKT complementarity conditions are

n:αn(ε+ξnyn+f(xn))=0n:αn*(ε+ξn*+ynf(xn))=0n:ξn(Cαn)=0n:ξn*(Cαn*)=0.

Solving the SVM Regression Optimization Problem

Solver Algorithms

The minimization problem can be expressed in standard quadratic programming form and solved using common quadratic programming techniques. However, it can be computationally expensive to use quadratic programming algorithms, especially since the Gram matrix may be too large to be stored in memory. Using a decomposition method instead can speed up the computation and avoid running out of memory.

Decomposition methods (also called chunking and working set methods) separate all observations into two disjoint sets: the working set and the remaining set. A decomposition method modifies only the elements in the working set in each iteration. Therefore, only some columns of the Gram matrix are needed in each iteration, which reduces the amount of storage needed for each iteration.

Sequential minimal optimization (SMO) is the most popular approach for solving SVM problems[4]. SMO performs a series of two-point optimizations. In each iteration, a working set of two points are chosen based on a selection rule that uses second-order information. Then the Lagrange multipliers for this working set are solved analytically using the approach described in [2] and [1].

In SVM regression, the gradient vector L for the active set is updated after each iteration. The decomposed equation for the gradient vector is

(L)n={i=1N(αiαi*)G(xi,xn)+εyn,nNi=1N(αiαi*)G(xi,xn)+ε+yn,n>N.

Iterative single data algorithm (ISDA) updates one Lagrange multiplier with each iteration[3]. ISDA is often conducted without the bias term b by adding a small positive constant a to the kernel function. Dropping b drops the sum constraint

n=1N(αiα*)=0

in the dual equation. This allows us to update one Lagrange multiplier in each iteration, which makes it easier than SMO to remove outliers. ISDA selects the worst KKT violator among all the αn and αn* values as the working set to be updated.

Convergence Criteria

Each of these solver algorithms iteratively computes until the specified convergence criterion is met. There are several options for convergence criteria:

  • Feasibility gap — The feasibility gap is expressed as

    Δ=J(β)+L(α)J(β)+1,

    where J(β) is the primal objective and L(α) is the dual objective. After each iteration, the software evaluates the feasibility gap. If the feasibility gap is less than the value specified by GapTolerance, then the algorithm met the convergence criterion and the software returns a solution.

  • Gradient difference — After each iteration, the software evaluates the gradient vector, L. If the difference in gradient vector values for the current iteration and the previous iteration is less than the value specified by DeltaGradientTolerance, then the algorithm met the convergence criterion and the software returns a solution.

  • Largest KKT violation — After each iteration, the software evaluates the KKT violation for all the αn and αn* values. If the largest violation is less than the value specified by KKTTolerance, then the algorithm met the convergence criterion and the software returns a solution.

References

[1] Fan, R.E. , P.H. Chen, and C.J. Lin. A Study on SMO-Type Decomposition Methods for Support Vector Machines. IEEE Transactions on Neural Networks, 17:893–908, 2006.

[2] Fan, R.E. , P.H. Chen, and C.J. Lin. Working Set Selection Using Second Order Information for Training Support Vector Machines. The Journal of machine Learning Research, 6:1871–1918, 2005.

[3] Huang, T.M., V. Kecman, and I. Kopriva. Kernel Based Algorithms for Mining Huge Data Sets: Supervised, Semi-Supervised, and Unsupervised Learning. Springer, New York, 2006.

[4] Platt, J. Sequential Minimal Optimization: A Fast Algorithm for Training Support Vector Machines. Technical Report MSR-TR-98–14, 1999.

[5] Vapnik, V. The Nature of Statistical Learning Theory. Springer, New York, 1995.

See Also

| | |

Related Topics