# Support Vector Machine Classifier and Regression (SVM)

Support Vector Machine (SVM) classification and regression are among popular
algorithms. It belongs to a family of generalized linear classification problems.

Operation | Computational methods | Programming Interface | |||

## Mathematical formulation

Training

Given

*feature vectors of size*n

*, their non-negative observation weights , and*p

*responses ,*n

Classification

- , where
is the number of classesM

Regression

Nu-classification

- , where
is the number of classesM

Nu-regression

the problem is to build a Support Vector Machine (SVM) classification, regression,
nu-classification, or nu-regression model.

The SVM model is trained using the Sequential minimal optimization (SMO) method [Boser92]
for reduced to the solution of the quadratic optimization problem

Classification

with , , ,
where

*is the vector of ones,*e

*is the upper bound of the coordinates of the vector ,*C

*is a symmetric matrix of size with , and is a kernel function.*Q

Regression

with , , ,
where

*is the upper bound of the coordinates of the vector ,*C

*is a symmetric matrix of size with , and is a kernel function. Vectors*Q

*and*s

*for the regression problem are formulated according to the following rule:*z

Where is the error tolerance parameter.

Nu-classification

with , ,
, ,
where

*is the vector of ones, is an upper bound on the fraction of training errors and a lower bound of the fraction of the support vector,*e

*is a symmetric matrix of size with , and is a kernel function.*Q

Nu-regression

with , ,
,
, where

*is the upper bound of the coordinates of the vector , is an upper bound on the fraction of training errors and a lower bound of the fraction of the support vector,*C

*is a symmetric matrix of size with , and is a kernel function. Vector*Q

*for the regression problem are formulated according to the following rule:*z

Working subset of α updated on each iteration of the algorithm is
based on the Working Set Selection (WSS) 3 scheme [Fan05].
The scheme can be optimized using one of these techniques or both:

: the implementation can allocate a predefined amount of memory to store intermediate results of the kernel computation.Cache: the implementation can try to decrease the amount of kernel related computations (see [Joachims99]).Shrinking

The solution of the problem defines the separating hyperplane and
corresponding decision function ,
where only those that correspond to non-zero appear in the sum,
and

*is a bias. Each non-zero is called a dual coefficient and the corresponding is called a support vector.*b

Training method:

smo

In

*training method, all vectors from the training dataset are used for each iteration.*smo

Training method:

thunder

In

*training method, the algorithm iteratively solves the convex optimization problem with the linear constraints by selecting the fixed set of active constrains (working set) and applying Sequential Minimal Optimization (SMO) solver to the selected subproblem. The description of this method is given in Algorithm [Wen2018].*thunder

Inference methods:

*and*smo

thunder

*and*

smo

*inference methods perform prediction in the same way:*

thunder

Given the SVM classification or regression model and

*feature vectors , the problem is to calculate the signed value of the decision function , . The sign of the value defines the class of the feature vector, and the absolute value of the function is a multiple of the distance between the feature vector and the separating hyperplane.*r

## Programming Interface

## Examples

oneAPI DPC++

Batch Processing:

oneAPI C++

Batch Processing:

Python* with DPC++ support

Batch Processing: