In addition to performinglinear classification, SVMs can efficiently perform non-linear classification using thekernel trick, representing the data only through a set of pairwise similarity comparisons between the original data points using a kernel function, which transforms them into coordinates in a higher-dimensionalfeature space. Thus, SVMs use the kernel trick to implicitly map their inputs into high-dimensional feature spaces, where linear classification can be performed.[3] Being max-margin models, SVMs are resilient to noisy data (e.g., misclassified examples). SVMs can also be used forregression tasks, where the objective becomes-sensitive.
The support vector clustering[4] algorithm, created byHava Siegelmann andVladimir Vapnik, applies the statistics of support vectors, developed in the support vector machines algorithm, to categorize unlabeled data.[citation needed] These data sets requireunsupervised learning approaches, which attempt to find naturalclustering of the data into groups, and then to map new data according to these clusters.
The popularity of SVMs is likely due to their amenability to theoretical analysis, and their flexibility in being applied to a wide variety of tasks, includingstructured prediction problems. It is not clear that SVMs have better predictive performance than other linear models, such aslogistic regression andlinear regression.[5]
H1 does not separate the classes. H2 does, but only with a small margin. H3 separates them with the maximal margin.
Classifying data is a common task inmachine learning.Suppose some given data points each belong to one of two classes, and the goal is to decide which class anewdata point will be in. In the case of support vector machines, a data point is viewed as a-dimensional vector (a list of numbers), and we want to know whether we can separate such points with a-dimensionalhyperplane. This is called alinear 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, ormargin, 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 themaximum-margin hyperplane and the linear classifier it defines is known as amaximum-margin classifier; or equivalently, theperceptron of optimal stability.[6]
More formally, a support vector machine constructs ahyperplane or set of hyperplanes in a high or infinite-dimensional space, which can be used forclassification,regression, or other tasks like outliers detection.[7] 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 thegeneralization error of the classifier.[8] A lowergeneralization error means that the implementer is less likely to experienceoverfitting.
Kernel machine
Whereas the original problem may be stated in a finite-dimensional space, it often happens that the sets to discriminate are notlinearly separable in that space. For this reason, it was proposed[9] 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 thatdot products of pairs of input data vectors may be computed easily in terms of the variables in the original space, by defining them in terms of akernel function selected to suit the problem.[10] 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, where such a set of vectors is an orthogonal (and thus minimal) set of vectors that defines a hyperplane. The vectors defining the hyperplanes can be chosen to be linear combinations with parameters of images offeature vectors that occur in the data base. With this choice of a hyperplane, the points in thefeature space that are mapped into the hyperplane are defined by the relation Note that if becomes small as grows further away from, each term in the sum measures the degree of closeness of the test point to the corresponding data base point. 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 mapped into any hyperplane can be quite convoluted as a result, allowing much more complex discrimination between sets that are not convex at all in the original space.
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 forimage segmentation systems, including those using a modified version SVM that uses the privileged approach as suggested by Vapnik.[13][14]
Classification of satellite data likeSAR data using supervised SVM.[15]
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.[18][19] Support vector machine weights have also been used to interpret SVM models in the past.[20] 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.
Maximum-margin hyperplane and margins for an SVM trained with samples from two classes. Samples on the margin are called the support vectors.
We are given a training dataset of points of the formwhere the are either 1 or −1, each indicating the class to which the point belongs. Each is a-dimensionalreal vector. We want to find the "maximum-margin hyperplane" that divides the group of points for which from the group of points for which, which is defined so that the distance between the hyperplane and the nearest point from either group is maximized.
Anyhyperplane can be written as the set of points satisfyingwhere is the (not necessarily normalized)normal vector to the hyperplane. This is much likeHesse normal form, except that is not necessarily a unit vector. The parameter determines the offset of the hyperplane from the origin along the normal vector.
Warning: most of the literature on the subject defines the bias so that
If the training data islinearly 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. With a normalized or standardized dataset, these hyperplanes can be described by the equations
(anything on or above this boundary is of one class, with label 1)
and
(anything on or below this boundary is of the other class, with label −1).
Geometrically, the distance between these two hyperplanes is,[21] so to maximize the distance between the planes we want to minimize. The distance is computed using thedistance from a point to a plane equation. We also have to prevent data points from falling into the margin, we add the following constraint: for each eitherorThese constraints state that each data point must lie on the correct side of the margin.
This can be rewritten as
1
We can put this together to get the optimization problem:
The and that solve this problem determine the final classifier,, where is thesign function.
An important consequence of this geometric description is that the max-margin hyperplane is completely determined by those that lie nearest to it (explained below). These are calledsupport vectors.
To extend SVM to cases in which the data are not linearly separable, thehinge loss function is helpful
Note that is thei-th target (i.e., in this case, 1 or −1), and is thei-th output.
This function is zero if the constraint in(1) is satisfied, in other words, if 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.
The goal of the optimization then is to minimize:
where the parameter determines the trade-off between increasing the margin size and ensuring that the lie on the correct side of the margin (Note we can add a weight to either term in the equation above). By deconstructing the hinge loss, this optimization problem can be formulated into the following:
Thus, for large values of, it will behave similar to the hard-margin SVM, if the input data are linearly classifiable, but will still learn if a classification rule is viable or not.
The original maximum-margin hyperplane algorithm proposed by Vapnik in 1963 constructed alinear classifier. However, in 1992,Bernhard Boser,Isabelle Guyon andVladimir Vapnik suggested a way to create nonlinear classifiers by applying thekernel trick (originally proposed by Aizerman et al.[22]) to maximum-margin hyperplanes.[9] The kernel trick, wheredot products are replaced by kernels, is easily derived in the dual representation of the SVM problem. This allows the algorithm to fit the maximum-margin hyperplane in a transformedfeature 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 thegeneralization error of support vector machines, although given enough samples the algorithm still performs well.[23]
The kernel is related to the transform by the equation. The valuew is also in the transformed space, with. Dot products withw for classification can again be computed by the kernel trick, i.e..
Computing the (soft-margin) SVM classifier amounts to minimizing an expression of the form
2
We focus on the soft-margin classifier since, as noted above, choosing a sufficiently small value for yields the hard-margin classifier for linearly classifiable input data. The classical approach, which involves reducing(2) to aquadratic programming problem, is detailed below. Then, more recent approaches such as sub-gradient descent and coordinate descent will be discussed.
By solving for theLagrangian dual of the above problem, one obtains the simplified problem
This is called thedual problem. Since the dual maximization problem is a quadratic function of the subject to linear constraints, it is efficiently solvable byquadratic programming algorithms.
Here, the variables are defined such that
Moreover, exactly when lies on the correct side of the margin, and when lies on the margin's boundary. It follows that can be written as a linear combination of the support vectors.
The offset,, can be recovered by finding an on the margin's boundary and solving
A training example of SVM with kernel given by φ((a,b)) = (a,b,a2 +b2)
Suppose now that we would like to learn a nonlinear classification rule which corresponds to a linear classification rule for the transformed data points Moreover, we are given a kernel function which satisfies.
We know the classification vector in the transformed space satisfies
where, the are obtained by solving the optimization problem
The coefficients can be solved for using quadratic programming, as before. Again, we can find some index such that, so that lies on the boundary of the margin in the transformed space, and then solve
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.
Note that is aconvex function of and. As such, traditionalgradient descent (orSGD) methods can be adapted, where instead of taking a step in the direction of the function's gradient, a step is taken in the direction of a vector selected from the function'ssub-gradient. This approach has the advantage that, for certain implementations, the number of iterations does not scale with, the number of data points.[24]
For each, iteratively, the coefficient is adjusted in the direction of. Then, the resulting vector of coefficients 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.[25]
The soft-margin support vector machine described above is an example of anempirical risk minimization (ERM) algorithm for thehinge 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.
In supervised learning, one is given a set of training examples with labels, and wishes to predict given. To do so one forms ahypothesis,, such that is a "good" approximation of. A "good" approximation is usually defined with the help of aloss function,, which characterizes how bad is as a prediction of. We would then like to choose a hypothesis that minimizes theexpected risk:
In most cases, we don't know the joint distribution of outright. In these cases, a common strategy is to choose the hypothesis that minimizes theempirical risk:
Under certain assumptions about the sequence of random variables (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 grows large. This approach is calledempirical risk minimization, or ERM.
In order for the minimization problem to have a well-defined solution, we have to place constraints on the set of hypotheses being considered. If is anormed space (as is the case for SVM), a particularly effective technique is to consider only those hypotheses for which . This is equivalent to imposing aregularization penalty, and solving the new optimization problem
Recall that the (soft-margin) SVM classifier is chosen to minimize the following expression:
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 thehinge loss
The difference between the hinge loss and these other loss functions is best stated in terms oftarget functions - the function that minimizes expected risk for a given pair of random variables.
In particular, let denote conditional on the event that. In the classification setting, we have:
The optimal classifier is therefore:
For the square-loss, the target function is the conditional expectation function,; For the logistic loss, it's the logit function,. While both of these target functions yield the correct classifier, as, they give us more information than we need. In fact, they give us enough information to completely describe the distribution of.
On the other hand, one can check that the target function for the hinge loss isexactly. 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) 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.[26]
SVMs belong to a family of generalizedlinear classifiers and can be interpreted as an extension of theperceptron.[27] They can also be considered a special case ofTikhonov regularization. A special property is that they simultaneously minimize the empiricalclassification error and maximize thegeometric margin; hence they are also known asmaximummargin classifiers.
A comparison of the SVM to other classifiers has been made by Meyer, Leisch and Hornik.[28]
The effectiveness of SVM depends on the selection of kernel, the kernel's parameters, and soft margin parameter.A common choice is a Gaussian kernel, which has a single parameter. The best combination of and is often selected by agrid search with exponentially growing sequences of and, for example,;. Typically, each combination of parameter choices is checked usingcross validation, and the parameters with best cross-validation accuracy are picked. Alternatively, recent work inBayesian optimization can be used to select and , 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.[29]
Potential drawbacks of the SVM include the following aspects:
Requires full labeling of input data
Uncalibratedclass 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 themulti-class SVM section.
Parameters of a solved model are difficult to interpret.
Building binary classifiers that distinguish between one of the labels and the rest (one-versus-all) or 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.
Crammer and Singer proposed a multiclass SVM method which casts themulticlass classification problem into a single optimization problem, rather than decomposing it into multiple binary classification problems.[34] See also Lee, Lin and Wahba[35][36] and Van den Burg and Groenen.[37]
Transductive support vector machines extend SVMs in that they could also treat partially labeled data insemi-supervised learning by following the principles oftransduction. Here, in addition to the training set, the learner is also given a set
of test examples to be classified. Formally, a transductive support vector machine is defined by the following primal optimization problem:[38]
Minimize (in)
subject to (for any and any)
and
Transductive support vector machines were introduced by Vladimir N. Vapnik in 1998.
Structured support-vector machine is an extension of the traditional SVM model. While the SVM model is primarily designed for binary classification, multiclass classification, and regression tasks, structured SVM broadens its application to handle general structured output labels, for example parse trees, classification with taxonomies, sequence alignment and many more.[39]
Support vector regression (prediction) with different thresholdsε. Asε increases, the prediction becomes less sensitive to errors.
A version of SVM forregression was proposed in 1996 byVladimir N. Vapnik, Harris Drucker, Christopher J. C. Burges, Linda Kaufman and Alexander J. Smola.[40] 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 asleast-squares support vector machine (LS-SVM) has been proposed by Suykens and Vandewalle.[41]
where is a training sample with target value. The inner product plus intercept is the prediction for that sample, and is a free parameter that serves as a threshold: all predictions have to be within an 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.
In 2011 it was shown by Polson and Scott that the SVM admits aBayesian interpretation through the technique ofdata augmentation.[43] In this approach the SVM is viewed as agraphical model (where the parameters are connected via probability distributions). This extended view allows the application ofBayesian techniques to SVMs, such as flexible feature modeling, automatichyperparameter tuning, andpredictive uncertainty quantification. Recently, a scalable version of the Bayesian SVM was developed byFlorian Wenzel, enabling the application of Bayesian SVMs tobig data.[44] Florian Wenzel developed two different versions, a variational inference (VI) scheme for the Bayesian kernel support vector machine (SVM) and a stochastic version (SVI) for the linear Bayesian SVM.[45]
The parameters of the maximum-margin hyperplane are derived by solving the optimization. There exist several specialized algorithms for quickly solving thequadratic programming (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 aninterior-point method that usesNewton-like iterations to find a solution of theKarush–Kuhn–Tucker conditions of the primal and dual problems.[46]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'ssequential 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.[47]
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 includessub-gradient descent (e.g., PEGASOS[48]) andcoordinate descent (e.g., LIBLINEAR[49]). 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 aQ-linear convergence property, making the algorithm extremely fast.
Preprocessing of data (standardization) is highly recommended to enhance accuracy of classification.[51] There are a few methods of standardization, such as min-max, normalization by decimal scaling, Z-score.[52] Subtraction of mean and division by variance of each feature is usually used for SVM.[53]
^Press, William H.; Teukolsky, Saul A.; Vetterling, William T.; Flannery, Brian P. (2007)."Section 16.5. Support Vector Machines".Numerical Recipes: The Art of Scientific Computing (3rd ed.). New York: Cambridge University Press.ISBN978-0-521-88068-8.Archived from the original on 2011-08-11.
^Joachims, Thorsten (1998). "Text categorization with Support Vector Machines: Learning with many relevant features".Machine Learning: ECML-98. Lecture Notes in Computer Science. Vol. 1398. Springer. pp. 137–142.doi:10.1007/BFb0026683.ISBN978-3-540-64417-0.
^Pradhan, Sameer S.; et al. (2 May 2004).Shallow Semantic Parsing using Support Vector Machines. Proceedings of the Human Language Technology Conference of the North American Chapter of the Association for Computational Linguistics: HLT-NAACL 2004. Association for Computational Linguistics. pp. 233–240.
^Vapnik, Vladimir N.: Invited Speaker. IPMU Information Processing and Management 2014).
^Aizerman, Mark A.; Braverman, Emmanuel M. & Rozonoer, Lev I. (1964). "Theoretical foundations of the potential function method in pattern recognition learning".Automation and Remote Control.25:821–837.
^Hsieh, Cho-Jui; Chang, Kai-Wei; Lin, Chih-Jen; Keerthi, S. Sathiya; Sundararajan, S. (2008-01-01). "A dual coordinate descent method for large-scale linear SVM".Proceedings of the 25th international conference on Machine learning - ICML '08. New York, NY, USA: ACM. pp. 408–415.CiteSeerX10.1.1.149.5594.doi:10.1145/1390156.1390208.ISBN978-1-60558-205-4.S2CID7880266.
^R. Collobert and S. Bengio (2004). Links between Perceptrons, MLPs and SVMs. Proc. Int'l Conf. on Machine Learning (ICML).
^Meyer, David; Leisch, Friedrich; Hornik, Kurt (September 2003). "The support vector machine under test".Neurocomputing.55 (1–2):169–186.doi:10.1016/S0925-2312(03)00431-4.
^Hsu, Chih-Wei; Chang, Chih-Chung & Lin, Chih-Jen (2003).A Practical Guide to Support Vector Classification(PDF) (Technical report). Department of Computer Science and Information Engineering, National Taiwan University.Archived(PDF) from the original on 2013-06-25.
^Lee, Yoonkyung; Lin, Yi & Wahba, Grace (2001)."Multicategory Support Vector Machines"(PDF).Computing Science and Statistics.33. Archived from the original on 2013-06-17.
^Drucker, Harris; Burges, Christ. C.; Kaufman, Linda; Smola, Alexander J.; and Vapnik, Vladimir N. (1997); "Support Vector Regression Machines", inAdvances in Neural Information Processing Systems 9, NIPS 1996, 155–161, MIT Press.
^Fan, Rong-En; Chang, Kai-Wei; Hsieh, Cho-Jui; Wang, Xiang-Rui; Lin, Chih-Jen (2008). "LIBLINEAR: A library for large linear classification".Journal of Machine Learning Research.9 (Aug):1871–1874.
Cristianini, Nello; Shawe-Taylor, John (2000).An Introduction to Support Vector Machines and other kernel-based learning methods. Cambridge University Press.ISBN0-521-78019-5.
Fradkin, Dmitriy; Muchnik, Ilya (2006)."Support Vector Machines for Classification"(PDF). In Abello, J.; Carmode, G. (eds.).Discrete Methods in Epidemiology. DIMACS Series in Discrete Mathematics and Theoretical Computer Science. Vol. 70. pp. 13–20.[citation not found]
Joachims, Thorsten (1998). "Text categorization with Support Vector Machines: Learning with many relevant features". In Nédellec, Claire; Rouveirol, Céline (eds.).Machine Learning: ECML-98. Lecture Notes in Computer Science. Vol. 1398. Berlin, Heidelberg: Springer. pp. 137–142.doi:10.1007/BFb0026683.ISBN978-3-540-64417-0.S2CID2427083.
James, Gareth; Witten, Daniela; Hastie, Trevor; Tibshirani, Robert (2013)."Support Vector Machines"(PDF).An Introduction to Statistical Learning : with Applications in R. New York: Springer. pp. 337–372.ISBN978-1-4614-7137-0.
Schölkopf, Bernhard; Smola, Alexander J. (2002).Learning with Kernels. Cambridge, MA: MIT Press.ISBN0-262-19475-9.
Steinwart, Ingo; Christmann, Andreas (2008).Support Vector Machines. New York: Springer.ISBN978-0-387-77241-7.