Least squares support vector machine

From HandWiki

Least squares support vector machines (LS-SVM) are least squares versions of support vector machines (SVM), which are a set of related supervised learning methods that analyze data and recognize patterns, and which are used for classification and regression analysis. In this version one finds the solution by solving a set of linear equations instead of a convex quadratic programming (QP) problem for classical SVMs. Least squares SVM classifiers, were proposed by Suykens and Vandewalle.[1] LS-SVMs are a class of kernel-based learning methods.

From support vector machine to least squares support vector machine

Given a training set [math]\displaystyle{ \{ x_i ,y_i \} _{i = 1}^N }[/math] with input data [math]\displaystyle{ x_i \in \mathbb{R}^n }[/math] and corresponding binary class labels [math]\displaystyle{ y_i \in \{ - 1, + 1\} }[/math], the SVM[2] classifier, according to Vapnik’s original formulation, satisfies the following conditions:

The spiral data [math]\displaystyle{ y_i=1 }[/math] for blue data point [math]\displaystyle{ y_i=-1 }[/math] for red data point
[math]\displaystyle{ \begin{cases} w^T \phi (x_i ) + b \ge 1, & \text{if } \quad y_i = + 1 , \\ w^T \phi (x_i ) + b \le - 1, & \text{if } \quad y_i = - 1 . \end{cases} }[/math]

Which is equivalent to

[math]\displaystyle{ y_i \left[ {w^T \phi (x_i ) + b} \right] \ge 1,\quad i = 1, \ldots ,N \, , }[/math]

where [math]\displaystyle{ \phi(x) }[/math] is the nonlinear map from original space to the high (and possibly infinite) dimensional space.

Inseparable data

In case such a separating hyperplane does not exist, we introduce so-called slack variables [math]\displaystyle{ \xi _i }[/math] such that

[math]\displaystyle{ \begin{cases} y_i \left[ {w^T \phi (x_i ) + b} \right] \ge 1 - \xi _i , & i = 1, \ldots ,N ,\\ \xi _i \ge 0, & i = 1, \ldots ,N . \end{cases} }[/math]

According to the structural risk minimization principle, the risk bound is minimized by the following minimization problem:

[math]\displaystyle{ \min J_1 (w,\xi )=\frac{1}{2}w^T w + c\sum\limits_{i = 1}^N {\xi _i } , }[/math]
[math]\displaystyle{ \text{Subject to } \begin{cases} y_i \left[ {w^T \phi (x_i ) + b} \right] \ge 1 - \xi _i , & i = 1, \ldots ,N , \\ \xi _i \ge 0, & i = 1, \ldots ,N , \end{cases} }[/math]
The result of the SVM classifier

To solve this problem, we could construct the Lagrangian function:

[math]\displaystyle{ L_1(w,b,\xi,\alpha,\beta)=\frac{1}{2}w^T w + c\sum\limits_{i = 1}^N {\xi _i } - \sum\limits_{i=1}^N \alpha_i \left\{ y_i \left[ {w^T \phi (x_i ) + b} \right] - 1 + \xi _i \right\} - \sum\limits_{i=1}^N \beta_i \xi_i, }[/math]

where [math]\displaystyle{ \alpha _i \ge 0,{\rm }\beta _i \ge 0\;(i = 1, \ldots ,N) }[/math] are the Lagrangian multipliers. The optimal point will be in the saddle point of the Lagrangian function, and then we obtain

[math]\displaystyle{ \begin{cases} \frac{ \partial L_1 }{\partial w} = 0\quad \to \quad w = \sum\limits_{i = 1}^N \alpha _i y_i \phi (x_i ) ,\\ \frac{\partial L_1 }{\partial b} = 0\quad \to \quad \sum\limits_{i = 1}^N \alpha _i y_i = 0 ,\\ \frac{\partial L_1 }{\partial \xi _i } = 0\quad \to \quad 0 \le \alpha _i \le c,\;i = 1, \ldots ,N . \end{cases} }[/math]

By substituting [math]\displaystyle{ w }[/math] by its expression in the Lagrangian formed from the appropriate objective and constraints, we will get the following quadratic programming problem:

[math]\displaystyle{ \max \;Q_1 (\alpha )\; = - \frac{1}{2}\sum\limits_{i,j = 1}^N {\alpha _i \alpha _j y_i y_j K(x_i ,x_j )} + \sum\limits_{i = 1}^N {\alpha _i } }[/math]

where [math]\displaystyle{ K(x_i ,x_j ) = \left\langle {\phi (x_i ),\phi (x_j )} \right\rangle }[/math] is called the kernel function. Solving this QP problem subject to constraints in (8), we will get the hyperplane in the high-dimensional space and hence the classifier in the original space.

Least squares SVM formulation

The least squares version of the SVM classifier is obtained by reformulating the minimization problem as:

[math]\displaystyle{ \min J_2 (w,b,e) = \frac{\mu }{2}w^T w + \frac{\zeta }{2}\sum\limits_{i = 1}^N {e_{i}^2 } , }[/math]

subject to the equality constraints:

[math]\displaystyle{ y_i \left[ {w^T \phi (x_i ) + b} \right] = 1 - e_{i} ,\quad i = 1, \ldots ,N . }[/math]

The least squares SVM (LS-SVM) classifier formulation above implicitly corresponds to a regression interpretation with binary targets [math]\displaystyle{ y_i = \pm 1 }[/math].

Using [math]\displaystyle{ y_i^2 = 1 }[/math], we have

[math]\displaystyle{ \sum\limits_{i = 1}^N {e_{i}^2 } = \sum\limits_{i = 1}^N {(y_i e_{i}^{} )^2 } = \sum\limits_{i = 1}^N {e_i^2 } = \sum\limits_{i = 1}^N {\left( {y_i - (w^T \phi (x_i ) + b)} \right)} ^2, }[/math]

with [math]\displaystyle{ e_i = y_i - (w^T \phi (x_i ) + b). }[/math] Notice, that this error would also make sense for least squares data fitting, so that the same end results holds for the regression case.

Hence the LS-SVM classifier formulation is equivalent to

[math]\displaystyle{ \;J_2 (w,b,e) = \mu E_W + \zeta E_D }[/math]

with [math]\displaystyle{ E_W = \frac{1}{2}w^T w }[/math] and [math]\displaystyle{ E_D = \frac{1}{2}\sum\limits_{i = 1}^N {e_i^2 } = \frac{1}{2}\sum\limits_{i = 1}^N {\left( {y_i - (w^T \phi (x_i ) + b)} \right)} ^2 . }[/math]

The result of the LS-SVM classifier

Both [math]\displaystyle{ \mu }[/math] and [math]\displaystyle{ \zeta }[/math] should be considered as hyperparameters to tune the amount of regularization versus the sum squared error. The solution does only depend on the ratio [math]\displaystyle{ \gamma = \zeta / \mu }[/math], therefore the original formulation uses only [math]\displaystyle{ \gamma }[/math] as tuning parameter. We use both [math]\displaystyle{ \mu }[/math] and [math]\displaystyle{ \zeta }[/math] as parameters in order to provide a Bayesian interpretation to LS-SVM.

The solution of LS-SVM regressor will be obtained after we construct the Lagrangian function:

[math]\displaystyle{ \begin{cases} L_2 (w,b,e,\alpha )\; = J_2 (w,e) - \sum\limits_{i = 1}^N \alpha _i \left\{ { \left[ {w^T \phi (x_i ) + b} \right] + e_i - y_i } \right\} ,\\ \quad \quad \quad \quad \quad \; = \frac{1}{2}w^T w + \frac{\gamma }{2} \sum\limits_{i = 1}^N e_i^2 - \sum\limits_{i = 1}^N \alpha _i \left\{ \left[ w^T \phi (x_i ) + b \right] + e_i -y_i \right\} , \end{cases} }[/math]

where [math]\displaystyle{ \alpha_i \in \mathbb{R} }[/math] are the Lagrange multipliers. The conditions for optimality are

[math]\displaystyle{ \begin{cases} \frac{\partial L_2 }{\partial w} = 0\quad \to \quad w = \sum\limits_{i = 1}^N \alpha _i \phi (x_i ) , \\ \frac{\partial L_2 }{\partial b} = 0\quad \to \quad \sum\limits_{i = 1}^N \alpha _i = 0 ,\\ \frac{\partial L_2 }{\partial e_i } = 0\quad \to \quad \alpha _i = \gamma e_i ,\;i = 1, \ldots ,N ,\\ \frac{\partial L_2 }{\partial \alpha _i } = 0\quad \to \quad y_i = w^T \phi (x_i ) + b + e_i ,\,i = 1, \ldots ,N . \end{cases} }[/math]

Elimination of [math]\displaystyle{ w }[/math] and [math]\displaystyle{ e }[/math] will yield a linear system instead of a quadratic programming problem:

[math]\displaystyle{ \left[ \begin{matrix} 0 & 1_N^T \\ 1_N & \Omega + \gamma ^{ - 1} I_N \end{matrix} \right] \left[ \begin{matrix} b \\ \alpha \end{matrix} \right] = \left[ \begin{matrix} 0 \\ Y \end{matrix} \right] , }[/math]

with [math]\displaystyle{ Y = [y_1 , \ldots ,y_N ]^T }[/math], [math]\displaystyle{ 1_N = [1, \ldots ,1]^T }[/math] and [math]\displaystyle{ \alpha = [\alpha _1 , \ldots ,\alpha _N ]^T }[/math]. Here, [math]\displaystyle{ I_N }[/math] is an [math]\displaystyle{ N \times N }[/math] identity matrix, and [math]\displaystyle{ \Omega \in \mathbb{R}^{N \times N} }[/math] is the kernel matrix defined by [math]\displaystyle{ \Omega _{ij} = \phi (x_i )^T \phi (x_j ) = K(x_i ,x_j ) }[/math].

Kernel function K

For the kernel function K(•, •) one typically has the following choices:

  • Linear kernel : [math]\displaystyle{ K(x,x_i ) = x_i^T x, }[/math]
  • Polynomial kernel of degree [math]\displaystyle{ d }[/math]: [math]\displaystyle{ K(x,x_i ) = \left( {1 + x_i^T x/c} \right)^d , }[/math]
  • Radial basis function RBF kernel : [math]\displaystyle{ K(x,x_i ) = \exp \left( { - \left\| {x - x_i } \right\|^2 /\sigma ^2 } \right), }[/math]
  • MLP kernel : [math]\displaystyle{ K(x,x_i ) = \tanh \left( {k\,x_i^T x + \theta } \right), }[/math]

where [math]\displaystyle{ d }[/math], [math]\displaystyle{ c }[/math], [math]\displaystyle{ \sigma }[/math], [math]\displaystyle{ k }[/math] and [math]\displaystyle{ \theta }[/math] are constants. Notice that the Mercer condition holds for all [math]\displaystyle{ c, \sigma \in \mathbb{R}^+ }[/math] and [math]\displaystyle{ d \in N }[/math] values in the polynomial and RBF case, but not for all possible choices of [math]\displaystyle{ k }[/math] and [math]\displaystyle{ \theta }[/math] in the MLP case. The scale parameters [math]\displaystyle{ c }[/math], [math]\displaystyle{ \sigma }[/math] and [math]\displaystyle{ k }[/math] determine the scaling of the inputs in the polynomial, RBF and MLP kernel function. This scaling is related to the bandwidth of the kernel in statistics, where it is shown that the bandwidth is an important parameter of the generalization behavior of a kernel method.

Bayesian interpretation for LS-SVM

A Bayesian interpretation of the SVM has been proposed by Smola et al. They showed that the use of different kernels in SVM can be regarded as defining different prior probability distributions on the functional space, as [math]\displaystyle{ P[f] \propto \exp \left( { - \beta \left\| {\hat Pf} \right\|^2 } \right) }[/math] . Here [math]\displaystyle{ \beta\gt 0 }[/math] is a constant and [math]\displaystyle{ \hat{P} }[/math] is the regularization operator corresponding to the selected kernel.

A general Bayesian evidence framework was developed by MacKay,[3][4][5] and MacKay has used it to the problem of regression, forward neural network and classification network. Provided data set [math]\displaystyle{ D }[/math], a model [math]\displaystyle{ \mathbb{M} }[/math] with parameter vector [math]\displaystyle{ w }[/math] and a so-called hyperparameter or regularization parameter [math]\displaystyle{ \lambda }[/math], Bayesian inference is constructed with 3 levels of inference:

  • In level 1, for a given value of [math]\displaystyle{ \lambda }[/math], the first level of inference infers the posterior distribution of [math]\displaystyle{ w }[/math] by Bayesian rule
[math]\displaystyle{ p(w|D,\lambda ,\mathbb{M}) \propto p(D|w,\mathbb{M})p(w|\lambda ,\mathbb{M}) }[/math]
  • The second level of inference determines the value of [math]\displaystyle{ \lambda }[/math], by maximizing
[math]\displaystyle{ p(\lambda |D,\mathbb{M}) \propto p(D|\lambda ,\mathbb{M})p(\lambda |\mathbb{M}) }[/math]
  • The third level of inference in the evidence framework ranks different models by examining their posterior probabilities
[math]\displaystyle{ p(\mathbb{M}|D) \propto p(D|\mathbb{M})p(\mathbb{M}). }[/math]

We can see that Bayesian evidence framework is a unified theory for learning the model and model selection. Kwok used the Bayesian evidence framework to interpret the formulation of SVM and model selection. And he also applied Bayesian evidence framework to support vector regression.

Now, given the data points [math]\displaystyle{ \{ x_i ,y_i \} _{i = 1}^N }[/math] and the hyperparameters [math]\displaystyle{ \mu }[/math] and [math]\displaystyle{ \zeta }[/math] of the model [math]\displaystyle{ \mathbb{M} }[/math], the model parameters [math]\displaystyle{ w }[/math] and [math]\displaystyle{ b }[/math] are estimated by maximizing the posterior [math]\displaystyle{ p(w,b|D,\log \mu ,\log \zeta ,\mathbb{M}) }[/math]. Applying Bayes’ rule, we obtain:

[math]\displaystyle{ p(w,b|D,\log \mu ,\log \zeta ,\mathbb{M}) = \frac{{p(D|w,b,\log \mu ,\log \zeta ,\mathbb{M})p(w,b|\log \mu ,\log \zeta ,\mathbb{M})}}{{p(D|\log \mu ,\log \zeta ,\mathbb{M})}} . }[/math]

Where [math]\displaystyle{ p(D|\log \mu ,\log \zeta ,\mathbb{M}) }[/math] is a normalizing constant such the integral over all possible [math]\displaystyle{ w }[/math] and [math]\displaystyle{ b }[/math] is equal to 1. We assume [math]\displaystyle{ w }[/math] and [math]\displaystyle{ b }[/math] are independent of the hyperparameter [math]\displaystyle{ \zeta }[/math], and are conditional independent, i.e., we assume

[math]\displaystyle{ p(w,b|\log \mu ,\log \zeta ,\mathbb{M}) = p(w|\log \mu ,\mathbb{M})p(b|\log \sigma _b ,\mathbb{M}) . }[/math]

When [math]\displaystyle{ \sigma _b \to \infty }[/math], the distribution of [math]\displaystyle{ b }[/math] will approximate a uniform distribution. Furthermore, we assume [math]\displaystyle{ w }[/math] and [math]\displaystyle{ b }[/math] are Gaussian distribution, so we obtain the a priori distribution of [math]\displaystyle{ w }[/math] and [math]\displaystyle{ b }[/math] with [math]\displaystyle{ \sigma _b \to \infty }[/math] to be:

[math]\displaystyle{ \begin{array}{l} p(w,b|\log \mu ,) = \left( {\frac{\mu }{{2\pi }}} \right)^{\frac{{n_f }}{2}} \exp \left( { - \frac{\mu }{2}w^T w} \right)\frac{1}{{\sqrt {2\pi \sigma _b } }}\exp \left( { - \frac{{b^2 }}{{2\sigma _b }}} \right) \\ \quad \quad \quad \quad \quad \quad \quad \propto \left( {\frac{\mu }{{2\pi }}} \right)^{\frac{{n_f }}{2}} \exp \left( { - \frac{\mu }{2}w^T w} \right) \end{array} . }[/math]

Here [math]\displaystyle{ n_f }[/math] is the dimensionality of the feature space, same as the dimensionality of [math]\displaystyle{ w }[/math].

The probability of [math]\displaystyle{ p(D|w,b,\log \mu ,\log \zeta ,\mathbb{M}) }[/math] is assumed to depend only on [math]\displaystyle{ w,b,\zeta }[/math] and [math]\displaystyle{ \mathbb{M} }[/math]. We assume that the data points are independently identically distributed (i.i.d.), so that:

[math]\displaystyle{ p(D|w,b,\log \zeta ,\mathbb{M}) = \prod\limits_{i = 1}^N {p(x_i ,y_i |w,b,\log \zeta ,\mathbb{M})} . }[/math]

In order to obtain the least square cost function, it is assumed that the probability of a data point is proportional to:

[math]\displaystyle{ p(x_i ,y_i |w,b,\log \zeta ,\mathbb{M}) \propto p(e_i |w,b,\log \zeta ,\mathbb{M}) . }[/math]

A Gaussian distribution is taken for the errors [math]\displaystyle{ e_i = y_i - (w^T \phi (x_i ) + b) }[/math] as:

[math]\displaystyle{ p(e_i |w,b,\log \zeta ,\mathbb{M}) = \sqrt {\frac{\zeta }{{2\pi }}} \exp \left( { - \frac{{\zeta e_i^2 }}{2}} \right) . }[/math]

It is assumed that the [math]\displaystyle{ w }[/math] and [math]\displaystyle{ b }[/math] are determined in such a way that the class centers [math]\displaystyle{ \hat m_ - }[/math] and [math]\displaystyle{ \hat m_ + }[/math] are mapped onto the target -1 and +1, respectively. The projections [math]\displaystyle{ w^T \phi (x) + b }[/math] of the class elements [math]\displaystyle{ \phi(x) }[/math] follow a multivariate Gaussian distribution, which have variance [math]\displaystyle{ 1/ \zeta }[/math].

Combining the preceding expressions, and neglecting all constants, Bayes’ rule becomes

[math]\displaystyle{ p(w,b|D,\log \mu ,\log \zeta ,\mathbb{M}) \propto \exp ( - \frac{\mu }{2}w^T w - \frac{\zeta }{2}\sum\limits_{i = 1}^N {e_i^2 } ) = \exp ( - J_2 (w,b)) . }[/math]

The maximum posterior density estimates [math]\displaystyle{ w_{MP} }[/math] and [math]\displaystyle{ b_{MP} }[/math] are then be obtained by minimizing the negative logarithm of (26), so we arrive (10).

References

  1. Suykens, J.A.K.; Vandewalle, J. (1999) "Least squares support vector machine classifiers", Neural Processing Letters, 9 (3), 293-300.
  2. Vapnik, V. The nature of statistical learning theory. Springer-Verlag, New York, 1995
  3. MacKay, D.J.C. Bayesian Interpolation. Neural Computation, 4(3): 415-447, May 1992.
  4. MacKay, D.J.C. A practical Bayesian framework for backpropagation networks. Neural Computation, 4(3): 448-472, May 1992.
  5. MacKay, D.J.C. The evidence framework applied to classification networks. Neural Computation, 4(5): 720-736, Sept. 1992.

Bibliography

  • J. A. K. Suykens, T. Van Gestel, J. De Brabanter, B. De Moor, J. Vandewalle, Least Squares Support Vector Machines, World Scientific Pub. Co., Singapore, 2002. ISBN:981-238-151-1
  • Suykens J.A.K., Vandewalle J., Least squares support vector machine classifiers, Neural Processing Letters, vol. 9, no. 3, Jun. 1999, pp. 293–300.
  • Vladimir Vapnik. The Nature of Statistical Learning Theory. Springer-Verlag, 1995. ISBN:0-387-98780-0
  • MacKay, D. J. C., Probable networks and plausible predictions—A review of practical Bayesian methods for supervised neural networks. Network: Computation in Neural Systems, vol. 6, 1995, pp. 469–505.

External links

  • www.esat.kuleuven.be/sista/lssvmlab/ "Least squares support vector machine Lab (LS-SVMlab) toolbox contains Matlab/C implementations for a number of LS-SVM algorithms."
  • www.kernel-machines.org "Support Vector Machines and Kernel based methods (Smola & Schölkopf)."
  • www.gaussianprocess.org "Gaussian Processes: Data modeling using Gaussian Process priors over functions for regression and classification (MacKay, Williams)"
  • www.support-vector.net "Support Vector Machines and kernel based methods (Cristianini)"
  • dlib: Contains a least-squares SVM implementation for large-scale datasets.