-->

Saturday, July 8, 2017

In machine learning, support vector machines (SVMs, also support vector networks) are supervised learning models with associated learning algorithms that analyze data used for classification and regression analysis. Given a set of training examples, each marked as belonging to one or the other of two categories, an SVM training algorithm builds a model that assigns new examples to one category or the other, making it a non-probabilistic binary linear classifier (although methods such as Platt scaling exist to use SVM in a probabilistic classification setting). An SVM model is a representation of the examples as points in space, mapped so that the examples of the separate categories are divided by a clear gap that is as wide as possible. New examples are then mapped into that same space and predicted to belong to a category based on on which side of the gap they fall.

In addition to performing linear classification, SVMs can efficiently perform a non-linear classification using what is called the kernel trick, implicitly mapping their inputs into high-dimensional feature spaces.

When data are not labeled, supervised learning is not possible, and an unsupervised learning approach is required, which attempts to find natural clustering of the data to groups, and then map new data to these formed groups. The clustering algorithm which provides an improvement to the support vector machines is called support vector clustering and is often used in industrial applications either when data are not labeled or when only some data are labeled as a preprocessing for a classification pass.

Motivation



source : rnd.azoft.com

Classifying data is a common task in machine learning. Suppose some given data points each belong to one of two classes, and the goal is to decide which class a new data point will be in. In the case of support vector machines, a data point is viewed as a p {\displaystyle p} -dimensional vector (a list of p {\displaystyle p} numbers), and we want to know whether we can separate such points with a ( p âˆ' 1 ) {\displaystyle (p-1)} -dimensional hyperplane. This is called a linear classifier. There are many hyperplanes that might classify the data. One reasonable choice as the best hyperplane is the one that represents the largest separation, or margin, between the two classes. So we choose the hyperplane so that the distance from it to the nearest data point on each side is maximized. If such a hyperplane exists, it is known as the maximum-margin hyperplane and the linear classifier it defines is known as a maximum margin classifier; or equivalently, the perceptron of optimal stability.

Definition



source : blog.krecan.net

More formally, a support vector machine constructs a hyperplane or set of hyperplanes in a high- or infinite-dimensional space, which can be used for classification, regression, or other tasks. Intuitively, a good separation is achieved by the hyperplane that has the largest distance to the nearest training-data point of any class (so-called functional margin), since in general the larger the margin the lower the generalization error of the classifier.

Whereas the original problem may be stated in a finite dimensional space, it often happens that the sets to discriminate are not linearly separable in that space. For this reason, it was proposed that the original finite-dimensional space be mapped into a much higher-dimensional space, presumably making the separation easier in that space. To keep the computational load reasonable, the mappings used by SVM schemes are designed to ensure that dot products may be computed easily in terms of the variables in the original space, by defining them in terms of a kernel function k ( x , y ) {\displaystyle k(x,y)} selected to suit the problem. The hyperplanes in the higher-dimensional space are defined as the set of points whose dot product with a vector in that space is constant. The vectors defining the hyperplanes can be chosen to be linear combinations with parameters α i {\displaystyle \alpha _{i}} of images of feature vectors x i {\displaystyle x_{i}} that occur in the data base. With this choice of a hyperplane, the points x {\displaystyle x} in the feature space that are mapped into the hyperplane are defined by the relation: âˆ' i α i k ( x i , x ) = c o n s t a n t . {\displaystyle \textstyle \sum _{i}\alpha _{i}k(x_{i},x)=\mathrm {constant} .} Note that if k ( x , y ) {\displaystyle k(x,y)} becomes small as y {\displaystyle y} grows further away from x {\displaystyle x} , each term in the sum measures the degree of closeness of the test point x {\displaystyle x} to the corresponding data base point x i {\displaystyle x_{i}} . In this way, the sum of kernels above can be used to measure the relative nearness of each test point to the data points originating in one or the other of the sets to be discriminated. Note the fact that the set of points x {\displaystyle x} mapped into any hyperplane can be quite convoluted as a result, allowing much more complex discrimination between sets which are not convex at all in the original space.

Applications



source : remotesensing.spiedigitallibrary.org

SVMs can be used to solve various real world problems:

  • SVMs are helpful in text and hypertext categorization as their application can significantly reduce the need for labeled training instances in both the standard inductive and transductive settings.
  • Classification of images can also be performed using SVMs. Experimental results show that SVMs achieve significantly higher search accuracy than traditional query refinement schemes after just three to four rounds of relevance feedback. This is also true of image segmentation systems, including those using a modified version SVM that uses the privileged approach as suggested by Vapnik.
  • Hand-written characters can be recognized using SVM.
  • The SVM algorithm has been widely applied in the biological and other sciences. They have been used to classify proteins with up to 90% of the compounds classified correctly. Permutation tests based on SVM weights have been suggested as a mechanism for interpretation of SVM models. Support vector machine weights have also been used to interpret SVM models in the past. Posthoc interpretation of support vector machine models in order to identify features used by the model to make predictions is a relatively new area of research with special significance in the biological sciences.

History



source : www.linkedin.com

The original SVM algorithm was invented by Vladimir N. Vapnik and Alexey Ya. Chervonenkis in 1963. In 1992, Bernhard E. Boser, Isabelle M. Guyon and Vladimir N. Vapnik suggested a way to create nonlinear classifiers by applying the kernel trick to maximum-margin hyperplanes. The current standard incarnation (soft margin) was proposed by Corinna Cortes and Vapnik in 1993 and published in 1995.

Linear SVM



We are given a training dataset of n {\displaystyle n} points of the form

( x â†' 1 , y 1 ) , … , ( x â†' n , y n ) {\displaystyle ({\vec {x}}_{1},y_{1}),\,\ldots ,\,({\vec {x}}_{n},y_{n})}

where the y i {\displaystyle y_{i}} are either 1 or âˆ'1, each indicating the class to which the point x â†' i {\displaystyle {\vec {x}}_{i}} belongs. Each x â†' i {\displaystyle {\vec {x}}_{i}} is a p {\displaystyle p} -dimensional real vector. We want to find the "maximum-margin hyperplane" that divides the group of points x â†' i {\displaystyle {\vec {x}}_{i}} for which y i = 1 {\displaystyle y_{i}=1} from the group of points for which y i = âˆ' 1 {\displaystyle y_{i}=-1} , which is defined so that the distance between the hyperplane and the nearest point x â†' i {\displaystyle {\vec {x}}_{i}} from either group is maximized.

Any hyperplane can be written as the set of points x â†' {\displaystyle {\vec {x}}} satisfying

w â†' â‹… x â†' âˆ' b = 0 , {\displaystyle {\vec {w}}\cdot {\vec {x}}-b=0,\,}

where w â†' {\displaystyle {\vec {w}}} is the (not necessarily normalized) normal vector to the hyperplane. This is much like Hesse normal form, except that w â†' {\displaystyle {\vec {w}}} is not necessarily a unit vector. The parameter b ∥ w â†' ∥ {\displaystyle {\tfrac {b}{\|{\vec {w}}\|}}} determines the offset of the hyperplane from the origin along the normal vector w â†' {\displaystyle {\vec {w}}} .

Hard-margin

If the training data are linearly separable, we can select two parallel hyperplanes that separate the two classes of data, so that the distance between them is as large as possible. The region bounded by these two hyperplanes is called the "margin", and the maximum-margin hyperplane is the hyperplane that lies halfway between them. These hyperplanes can be described by the equations

w â†' â‹… x â†' âˆ' b = 1 {\displaystyle {\vec {w}}\cdot {\vec {x}}-b=1\,}

and

w â†' â‹… x â†' âˆ' b = âˆ' 1. {\displaystyle {\vec {w}}\cdot {\vec {x}}-b=-1.\,}

Geometrically, the distance between these two hyperplanes is 2 ∥ w â†' ∥ {\displaystyle {\tfrac {2}{\|{\vec {w}}\|}}} , so to maximize the distance between the planes we want to minimize ∥ w â†' ∥ {\displaystyle \|{\vec {w}}\|} . As we also have to prevent data points from falling into the margin, we add the following constraint: for each i {\displaystyle i} either

w â†' â‹… x â†' i âˆ' b ≥ 1 , {\displaystyle {\vec {w}}\cdot {\vec {x}}_{i}-b\geq 1,} if y i = 1 {\displaystyle y_{i}=1}

or

w â†' â‹… x â†' i âˆ' b ≤ âˆ' 1 , {\displaystyle {\vec {w}}\cdot {\vec {x}}_{i}-b\leq -1,} if y i = âˆ' 1. {\displaystyle y_{i}=-1.}

These constraints state that each data point must lie on the correct side of the margin.

This can be rewritten as:

y i ( w â†' â‹… x â†' i âˆ' b ) ≥ 1 ,  for all  1 ≤ i ≤ n . ( 1 ) {\displaystyle y_{i}({\vec {w}}\cdot {\vec {x}}_{i}-b)\geq 1,\quad {\text{ for all }}1\leq i\leq n.\qquad \qquad (1)}

We can put this together to get the optimization problem:

"Minimize ∥ w â†' ∥ {\displaystyle \|{\vec {w}}\|} subject to y i ( w â†' â‹… x â†' i âˆ' b ) ≥ 1 , {\displaystyle y_{i}({\vec {w}}\cdot {\vec {x}}_{i}-b)\geq 1,} for i = 1 , … , n {\displaystyle i=1,\,\ldots ,\,n} "

The w â†' {\displaystyle {\vec {w}}} and b {\displaystyle b} that solve this problem determine our classifier, x â†' ↦ sgn ⁡ ( w â†' â‹… x â†' âˆ' b ) {\displaystyle {\vec {x}}\mapsto \operatorname {sgn}({\vec {w}}\cdot {\vec {x}}-b)} .

An easy-to-see but important consequence of this geometric description is that the max-margin hyperplane is completely determined by those x â†' i {\displaystyle {\vec {x}}_{i}} which lie nearest to it. These x â†' i {\displaystyle {\vec {x}}_{i}} are called support vectors.

Soft-margin

To extend SVM to cases in which the data are not linearly separable, we introduce the hinge loss function,

max ( 0 , 1 âˆ' y i ( w â†' â‹… x â†' i âˆ' b ) ) . {\displaystyle \max \left(0,1-y_{i}({\vec {w}}\cdot {\vec {x}}_{i}-b)\right).}

This function is zero if the constraint in (1) is satisfied, in other words, if x â†' i {\displaystyle {\vec {x}}_{i}} lies on the correct side of the margin. For data on the wrong side of the margin, the function's value is proportional to the distance from the margin.

We then wish to minimize

[ 1 n âˆ' i = 1 n max ( 0 , 1 âˆ' y i ( w â†' â‹… x â†' i âˆ' b ) ) ] + λ ∥ w â†' ∥ 2 , {\displaystyle \left[{\frac {1}{n}}\sum _{i=1}^{n}\max \left(0,1-y_{i}({\vec {w}}\cdot {\vec {x}}_{i}-b)\right)\right]+\lambda \lVert {\vec {w}}\rVert ^{2},}

where the parameter λ {\displaystyle \lambda } determines the tradeoff between increasing the margin-size and ensuring that the x â†' i {\displaystyle {\vec {x}}_{i}} lie on the correct side of the margin. Thus, for sufficiently small values of λ {\displaystyle \lambda } , the soft-margin SVM will behave identically to the hard-margin SVM if the input data are linearly classifiable, but will still learn if a classification rule is viable or not.

Nonlinear classification



The original maximum-margin hyperplane algorithm proposed by Vapnik in 1963 constructed a linear classifier. However, in 1992, Bernhard E. Boser, Isabelle M. Guyon and Vladimir N. Vapnik suggested a way to create nonlinear classifiers by applying the kernel trick (originally proposed by Aizerman et al.) to maximum-margin hyperplanes. The resulting algorithm is formally similar, except that every dot product is replaced by a nonlinear kernel function. This allows the algorithm to fit the maximum-margin hyperplane in a transformed feature space. The transformation may be nonlinear and the transformed space high dimensional; although the classifier is a hyperplane in the transformed feature space, it may be nonlinear in the original input space.

It is noteworthy that working in a higher-dimensional feature space increases the generalization error of support vector machines, although given enough samples the algorithm still performs well.

Some common kernels include:

  • Polynomial (homogeneous): k ( x i â†' , x j â†' ) = ( x i â†' â‹… x j â†' ) d {\displaystyle k({\vec {x_{i}}},{\vec {x_{j}}})=({\vec {x_{i}}}\cdot {\vec {x_{j}}})^{d}}
  • Polynomial (inhomogeneous): k ( x i â†' , x j â†' ) = ( x i â†' â‹… x j â†' + 1 ) d {\displaystyle k({\vec {x_{i}}},{\vec {x_{j}}})=({\vec {x_{i}}}\cdot {\vec {x_{j}}}+1)^{d}}
  • Gaussian radial basis function: k ( x i â†' , x j â†' ) = exp ⁡ ( âˆ' γ ∥ x i â†' âˆ' x j â†' ∥ 2 ) {\displaystyle k({\vec {x_{i}}},{\vec {x_{j}}})=\exp(-\gamma \|{\vec {x_{i}}}-{\vec {x_{j}}}\|^{2})} , for γ > 0 {\displaystyle \gamma >0} . Sometimes parametrized using γ = 1 / 2 σ 2 {\displaystyle \gamma =1/{2\sigma ^{2}}}
  • Hyperbolic tangent: k ( x i â†' , x j â†' ) = tanh ⁡ ( κ x i â†' â‹… x j â†' + c ) {\displaystyle k({\vec {x_{i}}},{\vec {x_{j}}})=\tanh(\kappa {\vec {x_{i}}}\cdot {\vec {x_{j}}}+c)} , for some (not every) κ > 0 {\displaystyle \kappa >0} and c < 0 {\displaystyle c<0}

The kernel is related to the transform φ ( x i â†' ) {\displaystyle \varphi ({\vec {x_{i}}})} by the equation k ( x i â†' , x j â†' ) = φ ( x i â†' ) â‹… φ ( x j â†' ) {\displaystyle k({\vec {x_{i}}},{\vec {x_{j}}})=\varphi ({\vec {x_{i}}})\cdot \varphi ({\vec {x_{j}}})} . The value w is also in the transformed space, with w â†' = âˆ' i α i y i φ ( x â†' i ) {\displaystyle \textstyle {\vec {w}}=\sum _{i}\alpha _{i}y_{i}\varphi ({\vec {x}}_{i})} . Dot products with w for classification can again be computed by the kernel trick, i.e. w â†' â‹… φ ( x â†' ) = âˆ' i α i y i k ( x â†' i , x â†' ) {\displaystyle \textstyle {\vec {w}}\cdot \varphi ({\vec {x}})=\sum _{i}\alpha _{i}y_{i}k({\vec {x}}_{i},{\vec {x}})} .

Computing the SVM classifier



Computing the (soft-margin) SVM classifier amounts to minimizing an expression of the form

[ 1 n âˆ' i = 1 n max ( 0 , 1 âˆ' y i ( w â‹… x i + b ) ) ] + λ ∥ w ∥ 2 . ( 2 ) {\displaystyle \left[{\frac {1}{n}}\sum _{i=1}^{n}\max \left(0,1-y_{i}(w\cdot x_{i}+b)\right)\right]+\lambda \lVert w\rVert ^{2}.\qquad (2)}

We focus on the soft-margin classifier since, as noted above, choosing a sufficiently small value for λ {\displaystyle \lambda } yields the hard-margin classifier for linearly classifiable input data. The classical approach, which involves reducing (2) to a quadratic programming problem, is detailed below. Then, more recent approaches such as sub-gradient descent and coordinate descent will be discussed.

Primal

Minimizing (2) can be rewritten as a constrained optimization problem with a differentiable objective function in the following way.

For each i ∈ { 1 , … , n } {\displaystyle i\in \{1,\,\ldots ,\,n\}} we introduce a variable ζ i = max ( 0 , 1 âˆ' y i ( w â‹… x i + b ) ) {\displaystyle \zeta _{i}=\max \left(0,1-y_{i}(w\cdot x_{i}+b)\right)} . Note that ζ i {\displaystyle \zeta _{i}} is the smallest nonnegative number satisfying y i ( w â‹… x i + b ) ≥ 1 âˆ' ζ i . {\displaystyle y_{i}(w\cdot x_{i}+b)\geq 1-\zeta _{i}.}

Thus we can rewrite the optimization problem as follows

minimize  1 n âˆ' i = 1 n ζ i + λ ∥ w ∥ 2 {\displaystyle {\text{minimize }}{\frac {1}{n}}\sum _{i=1}^{n}\zeta _{i}+\lambda \|w\|^{2}}
subject to  y i ( w â‹… x i + b ) ≥ 1 âˆ' ζ i  and  ζ i ≥ 0 , for all  i . {\displaystyle {\text{subject to }}y_{i}(w\cdot x_{i}+b)\geq 1-\zeta _{i}\,{\text{ and }}\,\zeta _{i}\geq 0,\,{\text{for all }}i.}

This is called the primal problem.

Dual

By solving for the Lagrangian dual of the above problem, one obtains the simplified problem

maximize f ( c 1 … c n ) = âˆ' i = 1 n c i âˆ' 1 2 âˆ' i = 1 n âˆ' j = 1 n y i c i ( x i â‹… x j ) y j c j , {\displaystyle {\text{maximize}}\,\,f(c_{1}\ldots c_{n})=\sum _{i=1}^{n}c_{i}-{\frac {1}{2}}\sum _{i=1}^{n}\sum _{j=1}^{n}y_{i}c_{i}(x_{i}\cdot x_{j})y_{j}c_{j},}
subject to  âˆ' i = 1 n c i y i = 0 , and  0 ≤ c i ≤ 1 2 n λ for all  i . {\displaystyle {\text{subject to }}\sum _{i=1}^{n}c_{i}y_{i}=0,\,{\text{and }}0\leq c_{i}\leq {\frac {1}{2n\lambda }}\;{\text{for all }}i.}

This is called the dual problem. Since the dual maximization problem is a quadratic function of the c i {\displaystyle c_{i}} subject to linear constraints, it is efficiently solvable by quadratic programming algorithms.

Here, the variables c i {\displaystyle c_{i}} are defined such that

w â†' = âˆ' i = 1 n c i y i x â†' i {\displaystyle {\vec {w}}=\sum _{i=1}^{n}c_{i}y_{i}{\vec {x}}_{i}} .

Moreover, c i = 0 {\displaystyle c_{i}=0} exactly when x â†' i {\displaystyle {\vec {x}}_{i}} lies on the correct side of the margin, and 0 < c i < ( 2 n λ ) âˆ' 1 {\displaystyle 0<c_{i}<(2n\lambda )^{-1}} when x â†' i {\displaystyle {\vec {x}}_{i}} lies on the margin's boundary. It follows that w â†' {\displaystyle {\vec {w}}} can be written as a linear combination of the support vectors.

The offset, b {\displaystyle b} , can be recovered by finding an x â†' i {\displaystyle {\vec {x}}_{i}} on the margin's boundary and solving

y i ( w â†' â‹… x â†' i + b ) = 1 ⟺ b = y i âˆ' w â†' â‹… x â†' i . {\displaystyle y_{i}({\vec {w}}\cdot {\vec {x}}_{i}+b)=1\iff b=y_{i}-{\vec {w}}\cdot {\vec {x}}_{i}.}

(Note that y i âˆ' 1 = y i {\displaystyle y_{i}^{-1}=y_{i}} since y i = ± 1 {\displaystyle y_{i}=\pm 1} .)

Kernel trick

Suppose now that we would like to learn a nonlinear classification rule which corresponds to a linear classification rule for the transformed data points φ ( x â†' i ) . {\displaystyle \varphi ({\vec {x}}_{i}).} Moreover, we are given a kernel function k {\displaystyle k} which satisfies k ( x â†' i , x â†' j ) = φ ( x â†' i ) â‹… φ ( x â†' j ) {\displaystyle k({\vec {x}}_{i},{\vec {x}}_{j})=\varphi ({\vec {x}}_{i})\cdot \varphi ({\vec {x}}_{j})} .

We know the classification vector w â†' {\displaystyle {\vec {w}}} in the transformed space satisfies

w â†' = âˆ' i = 1 n c i y i φ ( x â†' i ) , {\displaystyle {\vec {w}}=\sum _{i=1}^{n}c_{i}y_{i}\varphi ({\vec {x}}_{i}),}

where the c i {\displaystyle c_{i}} are obtained by solving the optimization problem

maximize f ( c 1 … c n ) = âˆ' i = 1 n c i âˆ' 1 2 âˆ' i = 1 n âˆ' j = 1 n y i c i ( φ ( x â†' i ) â‹… φ ( x â†' j ) ) y j c j = âˆ' i = 1 n c i âˆ' 1 2 âˆ' i = 1 n âˆ' j = 1 n y i c i k ( x â†' i , x â†' j ) y j c j {\displaystyle {\begin{aligned}{\text{maximize}}\,\,f(c_{1}\ldots c_{n})&=\sum _{i=1}^{n}c_{i}-{\frac {1}{2}}\sum _{i=1}^{n}\sum _{j=1}^{n}y_{i}c_{i}(\varphi ({\vec {x}}_{i})\cdot \varphi ({\vec {x}}_{j}))y_{j}c_{j}\\&=\sum _{i=1}^{n}c_{i}-{\frac {1}{2}}\sum _{i=1}^{n}\sum _{j=1}^{n}y_{i}c_{i}k({\vec {x}}_{i},{\vec {x}}_{j})y_{j}c_{j}\\\end{aligned}}}
subject to  âˆ' i = 1 n c i y i = 0 , and  0 ≤ c i ≤ 1 2 n λ for all  i . {\displaystyle {\text{subject to }}\sum _{i=1}^{n}c_{i}y_{i}=0,\,{\text{and }}0\leq c_{i}\leq {\frac {1}{2n\lambda }}\;{\text{for all }}i.}

The coefficients c i {\displaystyle c_{i}} can be solved for using quadratic programming, as before. Again, we can find some index i {\displaystyle i} such that 0 < c i < ( 2 n λ ) âˆ' 1 {\displaystyle 0<c_{i}<(2n\lambda )^{-1}} , so that φ ( x â†' i ) {\displaystyle \varphi ({\vec {x}}_{i})} lies on the boundary of the margin in the transformed space, and then solve

b = w â†' â‹… φ ( x â†' i ) âˆ' y i = [ âˆ' k = 1 n c k y k φ ( x â†' k ) â‹… φ ( x â†' i ) ] âˆ' y i = [ âˆ' k = 1 n c k y k k ( x â†' k , x â†' i ) ] âˆ' y i . {\displaystyle {\begin{aligned}b={\vec {w}}\cdot \varphi ({\vec {x}}_{i})-y_{i}&=\left[\sum _{k=1}^{n}c_{k}y_{k}\varphi ({\vec {x}}_{k})\cdot \varphi ({\vec {x}}_{i})\right]-y_{i}\\&=\left[\sum _{k=1}^{n}c_{k}y_{k}k({\vec {x}}_{k},{\vec {x}}_{i})\right]-y_{i}.\end{aligned}}}

Finally, new points can be classified by computing

z â†' ↦ sgn ⁡ ( w â†' â‹… φ ( z â†' ) + b ) = sgn ⁡ ( [ âˆ' i = 1 n c i y i k ( x â†' i , z â†' ) ] + b ) . {\displaystyle {\vec {z}}\mapsto \operatorname {sgn}({\vec {w}}\cdot \varphi ({\vec {z}})+b)=\operatorname {sgn} \left(\left[\sum _{i=1}^{n}c_{i}y_{i}k({\vec {x}}_{i},{\vec {z}})\right]+b\right).}

Modern methods

Recent algorithms for finding the SVM classifier include sub-gradient descent and coordinate descent. Both techniques have proven to offer significant advantages over the traditional approach when dealing with large, sparse datasetsâ€"sub-gradient methods are especially efficient when there are many training examples, and coordinate descent when the dimension of the feature space is high.

Sub-gradient descent

Sub-gradient descent algorithms for the SVM work directly with the expression

f ( w â†' , b ) = [ 1 n âˆ' i = 1 n max ( 0 , 1 âˆ' y i ( w â‹… x i + b ) ) ] + λ ∥ w ∥ 2 . {\displaystyle f({\vec {w}},b)=\left[{\frac {1}{n}}\sum _{i=1}^{n}\max \left(0,1-y_{i}(w\cdot x_{i}+b)\right)\right]+\lambda \lVert w\rVert ^{2}.}

Note that f {\displaystyle f} is a convex function of w â†' {\displaystyle {\vec {w}}} and b {\displaystyle b} . As such, traditional gradient descent (or SGD) methods can be adapted, where instead of taking a step in the direction of the functions gradient, a step is taken in the direction of a vector selected from the function's sub-gradient. This approach has the advantage that, for certain implementations, the number of iterations does not scale with n {\displaystyle n} , the number of data points.

Coordinate descent

Coordinate descent algorithms for the SVM work from the dual problem

maximize f ( c 1 … c n ) = âˆ' i = 1 n c i âˆ' 1 2 âˆ' i = 1 n âˆ' j = 1 n y i c i ( x i â‹… x j ) y j c j , {\displaystyle {\text{maximize}}\,\,f(c_{1}\ldots c_{n})=\sum _{i=1}^{n}c_{i}-{\frac {1}{2}}\sum _{i=1}^{n}\sum _{j=1}^{n}y_{i}c_{i}(x_{i}\cdot x_{j})y_{j}c_{j},}
subject to  âˆ' i = 1 n c i y i = 0 , and  0 ≤ c i ≤ 1 2 n λ for all  i . {\displaystyle {\text{subject to }}\sum _{i=1}^{n}c_{i}y_{i}=0,\,{\text{and }}0\leq c_{i}\leq {\frac {1}{2n\lambda }}\;{\text{for all }}i.}

For each i ∈ { 1 , … , n } {\displaystyle i\in \{1,\,\ldots ,\,n\}} , iteratively, the coefficient c i {\displaystyle c_{i}} is adjusted in the direction of ∂ f / ∂ c i {\displaystyle \partial f/\partial c_{i}} . Then, the resulting vector of coefficients ( c 1 ′ , … , c n ′ ) {\displaystyle (c_{1}',\,\ldots ,\,c_{n}')} is projected onto the nearest vector of coefficients that satisfies the given constraints. (Typically Euclidean distances are used.) The process is then repeated until a near-optimal vector of coefficients is obtained. The resulting algorithm is extremely fast in practice, although few performance guarantees have been proven.

Empirical risk minimization



The soft-margin support vector machine described above is an example of an empirical risk minimization (ERM) algorithm for the hinge loss. Seen this way, support vector machines belong to a natural class of algorithms for statistical inference, and many of its unique features are due to the behavior of the hinge loss. This perspective can provide further insight into how and why SVMs work, and allow us to better analyze their statistical properties.

Risk minimization

In supervised learning, one is given a set of training examples X 1 … X n {\displaystyle X_{1}\ldots X_{n}} with labels y 1 … y n {\displaystyle y_{1}\ldots y_{n}} , and wishes to predict y n + 1 {\displaystyle y_{n+1}} given X n + 1 {\displaystyle X_{n+1}} . To do so one forms a hypothesis, f {\displaystyle f} , such that f ( X n + 1 ) {\displaystyle f(X_{n+1})} is a "good" approximation of y n + 1 {\displaystyle y_{n+1}} . A "good" approximation is usually defined with the help of a loss function, â„" ( y , z ) {\displaystyle \ell (y,z)} , which characterizes how bad z {\displaystyle z} is as a prediction of y {\displaystyle y} . We would then like to choose a hypothesis that minimizes the expected risk:

ε ( f ) = E [ â„" ( y n + 1 , f ( X n + 1 ) ) ] {\displaystyle \varepsilon (f)=\mathbb {E} \left[\ell (y_{n+1},f(X_{n+1}))\right]}

In most cases, we don't know the joint distribution of X n + 1 , y n + 1 {\displaystyle X_{n+1},\,y_{n+1}} outright. In these cases, a common strategy is to choose the hypothesis that minimizes the empirical risk:

ε ^ ( f ) = 1 n âˆ' k = 1 n â„" ( y k , f ( X k ) ) {\displaystyle {\hat {\varepsilon }}(f)={\frac {1}{n}}\sum _{k=1}^{n}\ell (y_{k},f(X_{k}))}

Under certain assumptions about the sequence of random variables X k , y k {\displaystyle X_{k},\,y_{k}} (for example, that they are generated by a finite Markov process), if the set of hypotheses being considered is small enough, the minimizer of the empirical risk will closely approximate the minimizer of the expected risk as n {\displaystyle n} grows large. This approach is called empirical risk minimization, or ERM.

Regularization and stability

In order for the minimization problem to have a well-defined solution, we have to place constraints on the set H {\displaystyle {\mathcal {H}}} of hypotheses being considered. If H {\displaystyle {\mathcal {H}}} is a normed space (as is the case for SVM), a particularly effective technique is to consider only those hypotheses f {\displaystyle f} for which ∥ f ∥ H < k {\displaystyle \lVert f\rVert _{\mathcal {H}}<k} . This is equivalent to imposing a regularization penalty R ( f ) = λ k ∥ f ∥ H {\displaystyle {\mathcal {R}}(f)=\lambda _{k}\lVert f\rVert _{\mathcal {H}}} , and solving the new optimization problem

f ^ = a r g min f ∈ H ε ^ ( f ) + R ( f ) {\displaystyle {\hat {f}}=\mathrm {arg} \min _{f\in {\mathcal {H}}}{\hat {\varepsilon }}(f)+{\mathcal {R}}(f)} .

This approach is called Tikhonov regularization.

More generally, R ( f ) {\displaystyle {\mathcal {R}}(f)} can be some measure of the complexity of the hypothesis f {\displaystyle f} , so that simpler hypotheses are preferred.

SVM and the hinge loss

Recall that the (soft-margin) SVM classifier w ^ , b : x ↦ sgn ⁡ ( w ^ ⋅ x + b ) {\displaystyle {\hat {w}},b:x\mapsto \operatorname {sgn}({\hat {w}}\cdot x+b)} is chosen to minimize the following expression.

[ 1 n âˆ' i = 1 n max ( 0 , 1 âˆ' y i ( w â‹… x i + b ) ) ] + λ ∥ w ∥ 2 {\displaystyle \left[{\frac {1}{n}}\sum _{i=1}^{n}\max \left(0,1-y_{i}(w\cdot x_{i}+b)\right)\right]+\lambda \lVert w\rVert ^{2}}

In light of the above discussion, we see that the SVM technique is equivalent to empirical risk minimization with Tikhonov regularization, where in this case the loss function is the hinge loss

â„" ( y , z ) = max ( 0 , 1 âˆ' y z ) . {\displaystyle \ell (y,z)=\max \left(0,1-yz\right).}

From this perspective, SVM is closely related to other fundamental classification algorithms such as regularized least-squares and logistic regression. The difference between the three lies in the choice of loss function: regularized least-squares amounts to empirical risk minimization with the square-loss, â„" s q ( y , z ) = ( y âˆ' z ) 2 {\displaystyle \ell _{sq}(y,z)=(y-z)^{2}} ; logistic regression employs the log-loss, â„" log ( y , z ) = ln ⁡ ( 1 + e âˆ' y z ) {\displaystyle \ell _{\log }(y,z)=\ln(1+e^{-yz})} .

Target functions

The difference between the hinge loss and these other loss functions is best stated in terms of target functions - the function that minimizes expected risk for a given pair of random variables X , y {\displaystyle X,\,y} .

In particular, let y x {\displaystyle y_{x}} denote y {\displaystyle y} conditional on the event that X = x {\displaystyle X=x} . In the classification setting, we have:

y x = { 1 with probability  p x âˆ' 1 with probability  1 âˆ' p x {\displaystyle y_{x}={\begin{cases}1&{\text{with probability }}p_{x}\\-1&{\text{with probability }}1-p_{x}\end{cases}}}

The optimal classifier is therefore:

f ∗ ( x ) = { 1 if  p x ≥ 1 / 2 âˆ' 1 otherwise {\displaystyle f^{*}(x)={\begin{cases}1&{\text{if }}p_{x}\geq 1/2\\-1&{\text{otherwise}}\end{cases}}}

For the square-loss, the target function is the conditional expectation function, f s q ( x ) = E [ y x ] {\displaystyle f_{sq}(x)=\mathbb {E} \left[y_{x}\right]} ; For the logistic loss, it's the logit function, f log ⁡ ( x ) = ln ⁡ ( p x / ( 1 âˆ' p x ) ) {\displaystyle f_{\log(}x)=\ln \left(p_{x}/({1-p_{x}})\right)} . While both of these target functions yield the correct classifier, as sgn ⁡ ( f s q ) = sgn ⁡ ( f log ) = f ∗ {\displaystyle \operatorname {sgn}(f_{sq})=\operatorname {sgn}(f_{\log })=f^{*}} , they give us more information than we need. In fact, they give us enough information to completely describe the distribution of y x {\displaystyle y_{x}} .

On the other hand, one can check that the target function for the hinge loss is exactly f ∗ {\displaystyle f^{*}} . Thus, in a sufficiently rich hypothesis spaceâ€"or equivalently, for an appropriately chosen kernelâ€"the SVM classifier will converge to the simplest function (in terms of R {\displaystyle {\mathcal {R}}} ) that correctly classifies the data. This extends the geometric interpretation of SVMâ€"for linear classification, the empirical risk is minimized by any function whose margins lie between the support vectors, and the simplest of these is the max-margin classifier.

Properties



SVMs belong to a family of generalized linear classifiers and can be interpreted as an extension of the perceptron. They can also be considered a special case of Tikhonov regularization. A special property is that they simultaneously minimize the empirical classification error and maximize the geometric margin; hence they are also known as maximum margin classifiers.

A comparison of the SVM to other classifiers has been made by Meyer, Leisch and Hornik.

Parameter selection

The effectiveness of SVM depends on the selection of kernel, the kernel's parameters, and soft margin parameter C. A common choice is a Gaussian kernel, which has a single parameter γ {\displaystyle \gamma } . The best combination of C and γ {\displaystyle \gamma } is often selected by a grid search with exponentially growing sequences of C and γ {\displaystyle \gamma } , for example, C ∈ { 2 âˆ' 5 , 2 âˆ' 3 , … , 2 13 , 2 15 } {\displaystyle C\in \{2^{-5},2^{-3},\dots ,2^{13},2^{15}\}} ; γ ∈ { 2 âˆ' 15 , 2 âˆ' 13 , … , 2 1 , 2 3 } {\displaystyle \gamma \in \{2^{-15},2^{-13},\dots ,2^{1},2^{3}\}} . Typically, each combination of parameter choices is checked using cross validation, and the parameters with best cross-validation accuracy are picked. Alternatively, recent work in Bayesian optimization can be used to select C and γ {\displaystyle \gamma } , often requiring the evaluation of far fewer parameter combinations than grid search. The final model, which is used for testing and for classifying new data, is then trained on the whole training set using the selected parameters.

Issues

Potential drawbacks of the SVM include the following aspects:

  • Requires full labeling of input data
  • Uncalibrated class membership probabilities -- SVM stems from Vapnik's theory which avoids estimating probabilities on finite data
  • The SVM is only directly applicable for two-class tasks. Therefore, algorithms that reduce the multi-class task to several binary problems have to be applied; see the multi-class SVM section.
  • Parameters of a solved model are difficult to interpret.

Extensions



Support vector clustering (SVC)

SVC is a similar method that also builds on kernel functions but is appropriate for unsupervised learning and data-mining. It is considered a fundamental method in data science.

Multiclass SVM

Multiclass SVM aims to assign labels to instances by using support vector machines, where the labels are drawn from a finite set of several elements.

The dominant approach for doing so is to reduce the single multiclass problem into multiple binary classification problems. Common methods for such reduction include:

  • Building binary classifiers which distinguish (i) between one of the labels and the rest (one-versus-all) or (ii) between every pair of classes (one-versus-one). Classification of new instances for the one-versus-all case is done by a winner-takes-all strategy, in which the classifier with the highest output function assigns the class (it is important that the output functions be calibrated to produce comparable scores). For the one-versus-one approach, classification is done by a max-wins voting strategy, in which every classifier assigns the instance to one of the two classes, then the vote for the assigned class is increased by one vote, and finally the class with the most votes determines the instance classification.
  • Directed acyclic graph SVM (DAGSVM)
  • Error-correcting output codes

Crammer and Singer proposed a multiclass SVM method which casts the multiclass classification problem into a single optimization problem, rather than decomposing it into multiple binary classification problems. See also Lee, Lin and Wahba.

Transductive support vector machines

Transductive support vector machines extend SVMs in that they could also treat partially labeled data in semi-supervised learning by following the principles of transduction. Here, in addition to the training set D {\displaystyle {\mathcal {D}}} , the learner is also given a set

D ⋆ = { x â†' i ⋆ ∣ x â†' i ⋆ ∈ R p } i = 1 k {\displaystyle {\mathcal {D}}^{\star }=\{{\vec {x}}_{i}^{\star }\mid {\vec {x}}_{i}^{\star }\in \mathbb {R} ^{p}\}_{i=1}^{k}\,}

of test examples to be classified. Formally, a transductive support vector machine is defined by the following primal optimization problem:

Minimize (in w â†' , b , y ⋆ â†' {\displaystyle {{\vec {w}},b,{\vec {y^{\star }}}}} )

1 2 ∥ w â†' ∥ 2 {\displaystyle {\frac {1}{2}}\|{\vec {w}}\|^{2}}

subject to (for any i = 1 , … , n {\displaystyle i=1,\dots ,n} and any j = 1 , … , k {\displaystyle j=1,\dots ,k} )

y i ( w â†' â‹… x i â†' âˆ' b ) ≥ 1 , {\displaystyle y_{i}({\vec {w}}\cdot {\vec {x_{i}}}-b)\geq 1,\,}
y j ⋆ ( w â†' â‹… x j ⋆ â†' âˆ' b ) ≥ 1 , {\displaystyle y_{j}^{\star }({\vec {w}}\cdot {\vec {x_{j}^{\star }}}-b)\geq 1,}

and

y j ⋆ ∈ { âˆ' 1 , 1 } . {\displaystyle y_{j}^{\star }\in \{-1,1\}.\,}

Transductive support vector machines were introduced by Vladimir N. Vapnik in 1998.

Structured SVM

SVMs have been generalized to structured SVMs, where the label space is structured and of possibly infinite size.

Regression

A version of SVM for regression was proposed in 1996 by Vladimir N. Vapnik, Harris Drucker, Christopher J. C. Burges, Linda Kaufman and Alexander J. Smola. This method is called support vector regression (SVR). The model produced by support vector classification (as described above) depends only on a subset of the training data, because the cost function for building the model does not care about training points that lie beyond the margin. Analogously, the model produced by SVR depends only on a subset of the training data, because the cost function for building the model ignores any training data close to the model prediction. Another SVM version known as least squares support vector machine (LS-SVM) has been proposed by Suykens and Vandewalle.

Training the original SVR means solving

minimize 1 2 ∥ w ∥ 2 {\displaystyle {\frac {1}{2}}\|w\|^{2}}
subject to { y i âˆ' ⟨ w , x i ⟩ âˆ' b ≤ ε ⟨ w , x i ⟩ + b âˆ' y i ≤ ε {\displaystyle {\begin{cases}y_{i}-\langle w,x_{i}\rangle -b\leq \varepsilon \\\langle w,x_{i}\rangle +b-y_{i}\leq \varepsilon \end{cases}}}

where x i {\displaystyle x_{i}} is a training sample with target value y i {\displaystyle y_{i}} . The inner product plus intercept ⟨ w , x i ⟩ + b {\displaystyle \langle w,x_{i}\rangle +b} is the prediction for that sample, and ε {\displaystyle \varepsilon } is a free parameter that serves as a threshold: all predictions have to be within an ε {\displaystyle \varepsilon } range of the true predictions. Slack variables are usually added into the above to allow for errors and to allow approximation in the case the above problem is infeasible.

Implementation



The parameters of the maximum-margin hyperplane are derived by solving the optimization. There exist several specialized algorithms for quickly solving the QP problem that arises from SVMs, mostly relying on heuristics for breaking the problem down into smaller, more-manageable chunks.

Another approach is to use an interior point method that uses Newton-like iterations to find a solution of the Karushâ€"Kuhnâ€"Tucker conditions of the primal and dual problems. Instead of solving a sequence of broken down problems, this approach directly solves the problem altogether. To avoid solving a linear system involving the large kernel matrix, a low rank approximation to the matrix is often used in the kernel trick.

Another common method is Platt's sequential minimal optimization (SMO) algorithm, which breaks the problem down into 2-dimensional sub-problems that are solved analytically, eliminating the need for a numerical optimization algorithm and matrix storage. This algorithm is conceptually simple, easy to implement, generally faster, and has better scaling properties for difficult SVM problems.

The special case of linear support vector machines can be solved more efficiently by the same kind of algorithms used to optimize its close cousin, logistic regression; this class of algorithms includes sub-gradient descent (e.g., PEGASOS) and coordinate descent (e.g., LIBLINEAR). LIBLINEAR has some attractive training time properties. Each convergence iteration takes time linear in the time taken to read the train data and the iterations also have a Q-Linear Convergence property, making the algorithm extremely fast.

The general kernel SVMs can also be solved more efficiently using sub-gradient descent (e.g. P-packSVM), especially when parallelization is allowed.

Kernel SVMs are available in many machine learning toolkits, including LIBSVM, MATLAB, SAS, SVMlight, kernlab, scikit-learn, Shogun, Weka, Shark, JKernelMachines, OpenCV and others.

See also



  • In situ adaptive tabulation
  • Kernel machines
  • Fisher kernel
  • Platt scaling
  • Polynomial kernel
  • Predictive analytics
  • Regularization perspectives on support vector machines
  • Relevance vector machine, a probabilistic sparse kernel model identical in functional form to SVM
  • Sequential minimal optimization
  • Space mapping
  • Winnow (algorithm)

References



Bibliography



  • Theodoridis, Sergios; and Koutroumbas, Konstantinos; "Pattern Recognition", 4th Edition, Academic Press, 2009, ISBN 978-1-59749-272-0
  • Cristianini, Nello; and Shawe-Taylor, John; An Introduction to Support Vector Machines and other kernel-based learning methods, Cambridge University Press, 2000. ISBN 0-521-78019-5 (SVM Book)
  • Huang, Te-Ming; Kecman, Vojislav; and Kopriva, Ivica (2006); Kernel Based Algorithms for Mining Huge Data Sets, in Supervised, Semi-supervised, and Unsupervised Learning, Springer-Verlag, Berlin, Heidelberg, 260 pp. 96 illus., Hardcover, ISBN 3-540-31681-7
  • Kecman, Vojislav; Learning and Soft Computing â€" Support Vector Machines, Neural Networks, Fuzzy Logic Systems, The MIT Press, Cambridge, MA, 2001.
  • Schölkopf, Bernhard; and Smola, Alexander J.; Learning with Kernels, MIT Press, Cambridge, MA, 2002. ISBN 0-262-19475-9
  • Schölkopf, Bernhard; Burges, Christopher J. C.; and Smola, Alexander J. (editors); Advances in Kernel Methods: Support Vector Learning, MIT Press, Cambridge, MA, 1999. ISBN 0-262-19416-3.
  • Shawe-Taylor, John; and Cristianini, Nello; Kernel Methods for Pattern Analysis, Cambridge University Press, 2004. ISBN 0-521-81397-2 (Kernel Methods Book)
  • Steinwart, Ingo; and Christmann, Andreas; Support Vector Machines, Springer-Verlag, New York, 2008. ISBN 978-0-387-77241-7 (SVM Book)
  • Tan, Peter Jing; and Dowe, David L. (2004); MML Inference of Oblique Decision Trees, Lecture Notes in Artificial Intelligence (LNAI) 3339, Springer-Verlag, pp. 1082â€"1088. (This paper uses minimum message length (MML) and actually incorporates probabilistic support vector machines in the leaves of decision trees.)
  • Vapnik, Vladimir N.; The Nature of Statistical Learning Theory, Springer-Verlag, 1995. ISBN 0-387-98780-0
  • Vapnik, Vladimir N.; and Kotz, Samuel; Estimation of Dependences Based on Empirical Data, Springer, 2006. ISBN 0-387-30865-2, 510 pages [this is a reprint of Vapnik's early book describing philosophy behind SVM approach. The 2006 Appendix describes recent development].
  • Fradkin, Dmitriy; and Muchnik, Ilya; Support Vector Machines for Classification in Abello, J.; and Carmode, G. (Eds); Discrete Methods in Epidemiology, DIMACS Series in Discrete Mathematics and Theoretical Computer Science, volume 70, pp. 13â€"20, 2006. Succinctly describes theoretical ideas behind SVM.
  • Bennett, Kristin P.; and Campbell, Colin; Support Vector Machines: Hype or Hallelujah?, SIGKDD Explorations, 2, 2, 2000, 1â€"13. Excellent introduction to SVMs with helpful figures.
  • Ivanciuc, Ovidiu; Applications of Support Vector Machines in Chemistry, in Reviews in Computational Chemistry, Volume 23, 2007, pp. 291â€"400.
  • Catanzaro, Bryan; Sundaram, Narayanan; and Keutzer, Kurt; Fast Support Vector Machine Training and Classification on Graphics Processors, in International Conference on Machine Learning, 2008
  • Campbell, Colin; and Ying, Yiming; Learning with Support Vector Machines, 2011, Morgan and Claypool. ISBN 978-1-60845-616-1.
  • Ben-Hur, Asa, Horn, David, Siegelmann, Hava, and Vapnik, Vladimir; "Support vector clustering" (2001) Journal of Machine Learning Research, 2: 125â€"137.

External links



  • libsvm, LIBSVM is a popular library of SVM learners
  • liblinear is a library for large linear classification including some SVMs
  • SVM light is a collection of software tools for learning and classification using SVM
  • SVMJS live demo is a GUI demo for JavaScript implementation of SVMs


 
Sponsored Links