Classical NLPNLP 07· also in Classical machine learning
SVM Decision Boundary
A support vector machine finds the boundary with the widest margin between two classes. Only the points on or inside the margin (the support vectors, ringed) define it. A kernel lets the same method draw curved boundaries by comparing points in a richer feature space. Click to add points and watch the boundary retrain.
solid line: decision boundary (f = 0) · dashed: margins (f = ±1) · ring: support vector · C: penalty for points inside the margin · γ: how local each point's influence is
SVMs and text
Before deep learning, support vector machines were among the most accurate text classifiers: Joachims (1998) showed that they cope well with the thousands of word features in a TF-IDF representation. This demo uses two dimensions so that the boundary can be drawn; with text, every word is a dimension and the boundary is a flat hyperplane in that space.
How it is trained
The widest-margin boundary is the solution of an optimisation problem. This page solves it with sequential minimal optimisation (SMO), which repeatedly adjusts just two points at a time, each time choosing the pair that most violates the optimality conditions (the maximal-violating-pair rule of Keerthi et al., 2001). The widely used LIBSVM library is built on the same approach, but chooses the pair with a refinement that also uses second-order information (Fan, Chen & Lin, 2005). This solver was checked against LIBSVM, through scikit-learn, and finds the same solutions: its decision values agree to within the solvers’ tolerance.
References
- Boser, B. E., Guyon, I. M., & Vapnik, V. N. (1992). A training algorithm for optimal margin classifiers. In Proceedings of the Fifth Annual Workshop on Computational Learning Theory (pp. 144–152). doi.org/10.1145/130385.130401
- Cortes, C., & Vapnik, V. (1995). Support-vector networks. Machine Learning, 20(3), 273–297. doi.org/10.1007/BF00994018
- Joachims, T. (1998). Text categorization with support vector machines: learning with many relevant features. In Machine Learning: ECML-98, LNCS 1398 (pp. 137–142). Springer. doi.org/10.1007/BFb0026683
- Platt, J. (1998). Sequential minimal optimization: a fast algorithm for training support vector machines (Technical Report MSR-TR-98-14). Microsoft Research.
- Keerthi, S. S., Shevade, S. K., Bhattacharyya, C., & Murthy, K. R. K. (2001). Improvements to Platt’s SMO algorithm for SVM classifier design. Neural Computation, 13(3), 637–649. doi.org/10.1162/089976601300014493
- Fan, R.-E., Chen, P.-H., & Lin, C.-J. (2005). Working set selection using second order information for training support vector machines. Journal of Machine Learning Research, 6, 1889–1918. jmlr.org/papers/v6/fan05a.html
- Chang, C.-C., & Lin, C.-J. (2011). LIBSVM: a library for support vector machines. ACM Transactions on Intelligent Systems and Technology, 2(3), 27. doi.org/10.1145/1961189.1961199