The Entire Regularization Path for the Support Vector Machine

Similar documents
Regularization Paths

Regularization Paths. Theme

Jeff Howbert Introduction to Machine Learning Winter

LEAST ANGLE REGRESSION 469

Support Vector Machine (continued)

Indirect Rule Learning: Support Vector Machines. Donglin Zeng, Department of Biostatistics, University of North Carolina

Support Vector Machines II. CAP 5610: Machine Learning Instructor: Guo-Jun QI

Learning with kernels and SVM

Pattern Recognition 2018 Support Vector Machines

Chapter 9. Support Vector Machine. Yongdai Kim Seoul National University

Saharon Rosset 1 and Ji Zhu 2

Margin Maximizing Loss Functions

Polyhedral Computation. Linear Classifiers & the SVM

Support Vector Machines

Perceptron Revisited: Linear Separators. Support Vector Machines

Support Vector Machines for Classification: A Statistical Portrait

Outline. Basic concepts: SVM and kernels SVM primal/dual problems. Chih-Jen Lin (National Taiwan Univ.) 1 / 22

Support Vector Machines

Machine Learning and Data Mining. Support Vector Machines. Kalev Kask

Linear & nonlinear classifiers

ν =.1 a max. of 10% of training set can be margin errors ν =.8 a max. of 80% of training can be margin errors

Support Vector Machines for Classification and Regression

Data Mining. Linear & nonlinear classifiers. Hamid Beigy. Sharif University of Technology. Fall 1396

Support Vector Machine (SVM) and Kernel Methods

CSC 411 Lecture 17: Support Vector Machine

Classification and Support Vector Machine

A Revisit to Support Vector Data Description (SVDD)

Linear & nonlinear classifiers

Linear classifiers selecting hyperplane maximizing separation margin between classes (large margin classifiers)

Statistical Methods for Data Mining

Support Vector Machine (SVM) & Kernel CE-717: Machine Learning Sharif University of Technology. M. Soleymani Fall 2012

Support Vector Machines for Classification and Regression. 1 Linearly Separable Data: Hard Margin SVMs

SUPPORT VECTOR MACHINE

Stat542 (F11) Statistical Learning. First consider the scenario where the two classes of points are separable.

Nonlinear Support Vector Machines through Iterative Majorization and I-Splines

Linear classifiers selecting hyperplane maximizing separation margin between classes (large margin classifiers)

Linear, threshold units. Linear Discriminant Functions and Support Vector Machines. Biometrics CSE 190 Lecture 11. X i : inputs W i : weights

Support Vector Machine (SVM) and Kernel Methods

A GENERAL FORMULATION FOR SUPPORT VECTOR MACHINES. Wei Chu, S. Sathiya Keerthi, Chong Jin Ong

Regularization Path Algorithms for Detecting Gene Interactions

SVM Incremental Learning, Adaptation and Optimization

Introduction to Support Vector Machines

Support Vector Machine For Functional Data Classification

Support Vector Machines

Support Vector Machine (SVM) and Kernel Methods

Basis Expansion and Nonlinear SVM. Kai Yu

An introduction to Support Vector Machines

Introduction to Support Vector Machines

Support Vector Machine Regression for Volatile Stock Market Prediction

A note on the group lasso and a sparse group lasso

Statistical Methods for SVM

Support Vector Machines and Kernel Methods

A Tutorial on Support Vector Machine

Foundation of Intelligent Systems, Part I. SVM s & Kernel Methods

Support Vector Machine & Its Applications

Midterm. Introduction to Machine Learning. CS 189 Spring You have 1 hour 20 minutes for the exam.

Machine Learning And Applications: Supervised Learning-SVM

CS6375: Machine Learning Gautam Kunapuli. Support Vector Machines

UVA CS 4501: Machine Learning

Lecture 10: A brief introduction to Support Vector Machine

18.9 SUPPORT VECTOR MACHINES

Linear classifiers selecting hyperplane maximizing separation margin between classes (large margin classifiers)

L5 Support Vector Classification

Support Vector Machine

Variable Selection in Data Mining Project

Scale-Invariance of Support Vector Machines based on the Triangular Kernel. Abstract

Support'Vector'Machines. Machine(Learning(Spring(2018 March(5(2018 Kasthuri Kannan

Linear Classification and SVM. Dr. Xin Zhang

Support Vector Machines: Maximum Margin Classifiers

Support Vector Machines

Applied inductive learning - Lecture 7

CS 231A Section 1: Linear Algebra & Probability Review

CS 231A Section 1: Linear Algebra & Probability Review. Kevin Tang

Support Vector Machine for Classification and Regression

From Lasso regression to Feature vector machine

LINEAR CLASSIFIERS. J. Elder CSE 4404/5327 Introduction to Machine Learning and Pattern Recognition

Lecture 9: Large Margin Classifiers. Linear Support Vector Machines

Solving the SVM Optimization Problem

Lecture 6: Methods for high-dimensional problems

Neural Networks. Prof. Dr. Rudolf Kruse. Computational Intelligence Group Faculty for Computer Science

Lecture Support Vector Machine (SVM) Classifiers

Support Vector Machine

ICS-E4030 Kernel Methods in Machine Learning

Robust Kernel-Based Regression

Machine Learning Practice Page 2 of 2 10/28/13

Training Support Vector Machines: Status and Challenges

SVMC An introduction to Support Vector Machines Classification

Support Vector Machines

ML (cont.): SUPPORT VECTOR MACHINES

LECTURE 7 Support vector machines

LIBSVM: a Library for Support Vector Machines (Version 2.32)

SMO Algorithms for Support Vector Machines without Bias Term

UNIVERSITY of PENNSYLVANIA CIS 520: Machine Learning Final, Fall 2013

Least Angle Regression, Forward Stagewise and the Lasso

Lecture 18: Kernels Risk and Loss Support Vector Regression. Aykut Erdem December 2016 Hacettepe University

Support Vector Machines

Introduction to Support Vector Machines

A short introduction to supervised learning, with applications to cancer pathway analysis Dr. Christina Leslie

References. Lecture 7: Support Vector Machines. Optimum Margin Perceptron. Perceptron Learning Rule

Support Vector Machines Explained

Transcription:

The Entire Regularization Path for the Support Vector Machine Trevor Hastie Department of Statistics Stanford University Stanford, CA 905, USA hastie@stanford.edu Saharon Rosset IBM Watson Research Center P.O. Box 28 Yorktown Heights, N.Y. 0598 srosset@us.ibm.com Robert Tibshirani Department of Statistics Stanford University Stanford, CA 905, USA tibs@stanford.edu Ji Zhu Department of Statistics University of Michigan Ann Arbor, MI 809-092 jizhu@umich.edu Abstract In this paper we argue that the choice of the SVM cost parameter can be critical. We then derive an algorithm that can fit the entire path of SVM solutions for every value of the cost parameter, with essentially the same computational cost as fitting one SVM model. Introduction We have a set of n training pairs x i,y i, where x i R p is a p-vector of real valued predictors (attributes) for the ith observation, y i {, +} codes its binary response. The standard criterion for fitting the linear SVM )[, 2] is β 0,β 2 β 2 + C ξ i, () subject to, for each i: y i (β 0 + x T i β) ξ i. Here the ξ i are non-negative slack variables that allow points to be on the wrong side of their soft margin (f(x) =±), as well as the decision boundary, and C is a cost parameter that controls the amount of overlap. If the data are separable, then for sufficiently large C the solution achives the maximal margin separator; if not, the solution achieves the imum overlap solution with largest margin. Alternatively, we can formulate the problem using a (hinge) Loss + Penalty criterion [,]: β 0,β [ y i (β 0 + β T x i )] + + 2 β 2. (2) The regularization parameter in (2) corresponds to /C, with C in ().

This latter formulation emphasizes the role of regularization. In many situations we have sufficient variables (e.g. gene expression arrays) to guarantee separation. We may nevertheless avoid the maximum margin separator ( 0), which is governed by observations on the boundary, in favor of a more regularized solution involving more observations. The nonlinear kernel SVMs can be represented in this form as well. With kernel K and f(x) =β 0 + n θ ik(x, x i ), we solve [] β 0,θ [ y i (β 0 + j= θ i K(x i,x j ))] + 2 j= j = θ j θ j K(x j,x j). () Often the regularization parameter C (or ) is regarded as a genuine nuisance. Software packages, such as the widely used SVM light [5], provide default settings for C. To illustrate the effect of regularization, we generated data from a pair of mixture densities, described in detail in [, Chapter 2]. We used an SVM with a radial kernel K(x, x )= exp( γ x x 2 ). Figure shows the test error as a function of C for these data, using four different values for γ. Here we see a dramatic range in the correct choice for C (or =/C). When γ =5, the most regularized model is called for; when γ =0., the least regularized. Test Error 0.20 0.25 0.0 0.5 Test Error Curves SVM with Radial Kernel γ =5 γ = γ =0.5 γ =0. e 0 e+0 e+0 e 0 e+0 e+0 e 0 e+0 e+0 e 0 e+0 e+0 C =/ Figure : Test error curves for the mixture example, using four different values for the radial kernel parameter γ. One of the reasons that investigators avoid extensive exploration of C is the computational cost involved. In this paper we develop an algorithm which fits the entire path of SVM solutions [β 0 (C),β(C)], for all possible values of C, with essentially the computational cost of fitting a single model for a particular value of C. Our algorithm exploits the fact that the Lagrange multipliers implicit in () are piecewise-linear in C. This also means that the coefficients ˆβ(C) are also piecewise-linear in C. This is true for all SVM models, both linear and nonlinear kernel-based SVMs. 2 Problem Setup We use a criterion equivalent to (), implementing the formulation in (2): ξ i + 2 βt β subject to y i f(x i ) ξ i ; ξ i 0; f(x) =β 0 + β T x. () β,β 0 Initially we consider only linear SVMs to get the intuitive flavor of our procedure; we then generalize to kernel SVMs.

We construct the Lagrange primal function L P : ξ i + 2 βt β + α i ( y i f(x i ) ξ i ) γ i ξ i (5) and set the derivatives to zero. This gives β : β = α i y i x i (6) : y i α i =0, β 0 (7) along with the KKT conditions α i ( y i f(x i ) ξ i ) = 0 (8) γ i ξ i = 0 (9) α i γ i = 0 (0) We see that 0 α i, with α i =when ξ i > 0 (which is when y i f(x i ) < ). Also when y i f(x i ) >, ξ i =0since no cost is incurred, and α i =0. When y i f(x i )=, α i can lie between 0 and. The usual Lagrange multipliers associated with the solution to () are α i = α i/ = Cα i. We prefer our formulation here since our α i [0, ], and this simplifies the definition of the paths we define. We wish to find the entire solution path for all values of 0. Our basic idea is as follows. We start with large and decrease it towards zero, keeping track of all the events that occur along the way. As decreases, β increases, and hence the width of the margin decreases. As this width decreases, points move from being inside to outside their margins. Their corresponding α i change from α i =when they are inside their margin (y i f(x i ) < ) to α i =0when they are outside their margin (y i f(x i ) > ). By continuity, points must linger on the margin (y i f(x i )=) while their α i decrease from to 0. We will see that the α i () trajectories are piecewise-linear in, which affords a great computational savings: as long as we can establish the break points, all values in between can be found by simple linear interpolation. Note that points can return to the margin, after having passed through it. It is easy to show that if the α i () are piecewise linear in, then both α i (C) =Cα i(c) and β(c) are pieceise linear in C. It turns out that β 0 (C) is also piecewise linear in C. Our algorithm keeps track of the following sets: M={i: y i f(x i )=, 0 α i }, M for Margin I={i: y i f(x i ) <, α i =}, I for Inside the margin O={i: y i f(x i ) >, α i =0}, O for Outside the margin The Algorithm Due to space restrictions, we show some details here; the rest can be found in [7]. Initialization The initial conditions depend on whether the classes are balanced or not (n + = n ). The balanced case is easier. For very large, β is small, and the the margin is very wide,

all points are in O, and hence α i = i. From (6) this means the orientation of β is fixed until the α i change. The margin narrows as decreases, but the orientation remains fixed. Because of (7), the narrowing margin must connect with an outermost member of each class simultaneously. These points are easily identified, and this establishes the first event, the first tenants of M, and β 0. When n n +, the setup is more complex. In order to satisfy the constraint (7), a quadratic programg algorithm is needed to obtain the initial configuration. See [7] for details. Kernels The development so far has been in the original feature space. It is easy to see that the entire development carries through with kernels as well. In this case f(x) =β 0 + g(x), and the only change that occurs is that (6) is changed to g(x i )= α j y j K(x i,x j ),,...,n, () j= or θ j () =α j y j / using the notation in (). Hereafter we will develop our algorithm for this more general kernel case. The Path The algorithm hinges on the set of points M sitting on the margin. We consider M at the point that an event has occurred:. The initial event, which means 2 or more points start in M, with their inital values of α [0, ]. 2. A point from I has just entered M, with its value of α i initially.. A point from O has reentered M, with its value of α i initially 0.. One or more points in M has left the set, to join either O or I. Whichever the case, for continuity reasons this set will stay stable until the next event occurs, since to pass through M, a point s α i must change from 0 to or vice versa. Since all points in M have y i f(x i )=, we can establish a path for their α i. We use the subscript l to index the sets above immediately after the lth event has occurred. Suppose M l = m, and let αi l,βl 0 and l be the values of these parameters at the point of entry. Likewise f l is the function at this point. For convenience we define α 0 = β 0, and hence α0 l = l β0. l Since f(x) = y j α j K(x, x j )+α 0, (2) j= for l >> l+ we can write [ f(x) = f(x) ] l f l (x) + l f l (x) = (α j α j)y l j K(x, x j )+(α 0 α0)+ l l f l (x). ()

The second line follows because all the observations in I l have their α i =, and those in O l have their α i =0, for this range of. Since each of the m points x i M l are to stay at the elbow, we have that (α j α j)y l i y j K(x i,x j )+y i (α 0 α0)+ l l =, i M l. () Writing δ j = α l j α j, from () we have δ j y i y j K(x i,x j )+y i δ 0 = l, i M l. (5) Furthermore, since at all times n y iα i =0, we have that y j δ j =0. (6) Equations (5) and (6) constitute m +linear equations in m +unknowns δ j, and can be solved. The δ j and hence α j will change linearly in, until the next event occurs: α j = α l j ( l )b j,j {0} M l. (7) See [7] for more precise details on solving these equations. From () we have f(x) = l [ f l (x) h l (x) ] + h l (x), (8) where h l (x) = y j b j K(x, x j )+b 0 (9) Thus the function itself changes in a piecewise-inverse manner in. Finding l+ The paths continue until one of the following events occur:. One of the α i for i M l reaches a boundary (0 or ). For each i the value of for which this occurs is easily established. 2. One of the points in I l or O l attains y i f(x i )=. By exaing these conditions, we can establish the largest < l for which an event occurs, and hence establish l+ and update the sets. Teration In the separable case, we terate when I becomes empty. At this point, all the ξ i in () are zero, and further movement increases the norm of β unnecessarily. In the non-separable case, runs all the way down to zero. For this to happen without f blowing up in (8), we must have f l h l =0, and hence the boundary and margins remain fixed at a point where i ξ i is as small as possible, and the margin is as wide as possible subject to this constraint.

2 2 2 2 2 2 22 2 2 2 2 2 2 2. Computational Complexity At any update event l along the path of our algorithm, the main computational burdon is solving the system of equations of size m l = M l. While this normally involves O(m l ) computations, since M l+ differs from M l by typically one observation, inverse updating can reduce the computations to O(m 2 l ). The computation of hl (x i ) in (9) requires O(nm l ) computations. Beyond that, several checks of cost O(n) are needed to evaluate the next move. Size Elbow 0 20 0 60 80 00 2 2 22 22 2 γ =5 22 2 2 2 22 2 2 2 γ =0.5 2 22 22 22 2 22 2 2 22 2 22 2 2 2 2 2 γ =0. 2 2 2 2 2 22 22 γ = 2 2 2 2 Eigenvalue e 5 e e 07 e 0 e+0 2 γ =5 22 2 2 2 γ = 2 2 γ =0.52 22 γ =0. 2 2 2 22 2 22 2 22 22 2 2 e 0 e 02 e+00 0 50 00 50 200 Eigenvalue Sequence Figure 2: [Left] The elbow sizes M l as a function of, for different values of the radial-kernel parameter γ. The vertical lines show the positions used to compare the times with libsvm. [Right] The eigenvalues (on the log scale) for the kernel matrices K γ corresponding to the four values of γ.the larger eigenvalues correspond in this case to smoother eigenfunctions, the small ones to rougher. The rougher eigenfunctions get penalized exponentially more than the smoother ones. For smaller values of γ, the effective dimension of the space is truncated. Although we have no hard results, our experience so far suggests that the total number Λ of moves is O(k (n +,n )), for k around 6; hence typically some small multiple c of n. If the average size of M l is m, this suggests the total computational burdon is O(cn 2 m + nm 2 ), which is similar to that of a single SVM fit. Our R function SvmPath computes all 62 steps in the mixture example (n + = n = 00, radial kernel, γ =) in.(0.02) secs on a pentium, 2Ghz linux machine; the svm function (using the optimized code libsvm, from the R library e07) takes 9.28(0.06) seconds to compute the solution at 0 points along the path. Hence it takes our procedure about 50% more time to compute the entire path, than it costs libsvm to compute a typical single solution. Mixture simulation continued The l in Figure are the entire collection of changepoints as described in Section. We were at first surprised to discover that not all these sequences achieved zero training errors on the 200 training data points, at their least regularized fit. In fact the imal training errors, and the corresponding values for γ are summarized in Table. It is usually argued that the implicit feature space is infinite dimensional for this kernel, which suggests that perfect separation is always possible. The last row of the table shows the effective rank of the 200 200 kernel gram matrix K (which we defined to be the number of singular values greater than 0 2 ). In general a full rank K is required to achieve perfect separation. This emphasizes the fact that not all features in the feature map implied by K are of equal stature; many of them are shrunk way down to zero. Rephrasing, the regularization in ()

γ 5 0.5 0. Training Errors 0 2 2 Effective Rank 200 77 76 Table : The number of imal training errors for different values of the radial kernel scale parameter γ, for the mixture simulation example. Also shown is the effective rank of the 200 200 gram matrix K γ. penalizes unit-norm features by the inverse of their eigenvalues, which effectively anihilates some, depending on γ. Small γ implies wide, flat kernels, and a suppression of wiggly, rough functions. Writing () in matrix form, β 0,θ L[y, Kθ]+ 2 θt Kθ, (20) we reparametrize using the eigen-decomposition of K = UDU T. Let Kθ = Uθ where θ = DU T θ. Then (20) becomes L[y, β Uθ ]+ 0,θ 2 θ T D θ. (2) Now the columns of U are unit-norm basis functions (in R 2 ) spanning the column space of K; from (2) we see that those members corresesponding to near-zero eigenvalues (the elements of the diagonal matrix D) get heavily penalized and hence ignored. Figure 2 shows the elements of D for the four values of γ. See [, Chapter 5] for more details. 5 Discussion Our work on the SVM path algorithm was inspired by early work on exact path algorithms in other settings. Least Angle Regression [8] show that the coefficient path for the sequence of lasso coefficients is piecewise linear. The lasso uses a quadratic criterion, with an L constraint. In fact, any model with an L constraint and a quadratic, piecewise quadratic, piecewise linear, or mixed quadratic and linear loss function, will have piecewise linear coefficient paths, which can be calculated exactly and efficiently for all values of [0]. This includes the L SVM []. The SVM model has a quadratic constraint and a piecewise linear ( hinge ) loss function. This leads to a piecewise linear path in the dual space, hence the Lagrange coefficients α i are piecewise linear. Of course, quadratic criterion + quadratic constraints also lead to exact path solutions, as in the classic ridge regression case, since a closed form solution is obtained via the SVD. The general techniques employed in this paper are known as parametric fiin convex optimization. The closest we have seen to our work in the literature employ similar techniques in incremental learning for SVMs [2, ]. These authors do not, however, construct exact paths as we do, but rather focus on updating and downdating the solutions as more (or less) data arises. [] allow for updating the parameters as well, but again do not construct entire solution paths. The SvmPath has been implemented in the R computing environment, and is available from the first author s website.

Acknowledgements The authors thank Jerome Friedman for helpful discussions, and Mee Young Park for assisting with some of the computations. Trevor Hastie was partially supported by grant DMS-02062 from the National Science Foundation, and grant RO-EB00988-08 from the National Institutes of Health. References [] Vladimir Vapnik. The Nature of Statistical Learning. Springer-Verlag, 996. [2] Bernard Schölkopf and Alex Smola. Learning with Kernels: Support Vector Machines, Regularization, Optimization, and Beyond (Adaptive Computation and Machine Learning). MIT Press, 200. [] G. Wahba, Y. Lin, and H. Zhang. Gacv for support vector machines. In A.J. Smola, P.L. Bartlett, B. Schölkopf, and D. Schuurmans, editors, Advances in Large Margin Classifiers, pages 297, Cambridge, MA, 2000. MIT Press. [] T. Hastie, R. Tibshirani, and J. Friedman. The Elements of Statistical Learning; Data ing, Inference and Prediction. Springer Verlag, New York, 200. [5] Thorsten Joachims. Practical Advances in Kernel Methods Support Vector Learning, chapter Making large scale SVM learning practical. MIT Press, 999. see http://svmlight.joachims.org. [6] Chih-Wei Hsu, Chih-Chung Chang, and Chih-Jen Lin. A practical guide to support vector classification. Technical report, Department of Computer Science and Information Engineering, National Taiwan University, Taipei, 200. http://www.csie.ntu.edu.tw/ cjlin/libsvm/. [7] Trevor Hastie, Saharon Rosset, Robert Tibshirani, and Ji Zhu. The entire regularization path for the support vector machine. Technical report, Statistics Department, Stanford University, 200. [8] B. Efron, T. Hastie, I. Johnstone, and R.. Tibshirani. Least angle regression. Technical report, Stanford University, 2002. [9] R. Tibshirani. Regression shrinkage and selection via the lasso. J. Royal. Statist. Soc. B., 58:267 288, 996. [0] Saharon Rosset and Ji Zhu. Piecewise linear regularized solution paths. Technical report, Stanford University, 200. http://www-stat.stanford.edu/ saharon/papers/piecewise.ps. [] Ji Zhu, Saharon Rosset, Trevor Hastie, and Robert Tibshirani. L norm support vector machines. Technical report, Stanford University, 200. [2] Shai Fine and Katya Scheinberg. Incas: An incremental active set method for svm. Technical report, IBM Research Labs, Haifa, 2002. [] G. Cauwenberghs and T. Poggio. Incremental and decremental support vector machine learning. In Advances in Neural Information Processing Systems (NIPS*2000), volume. MIT Press, Cambridge, MA, 200. [] Christopher Diehl and Gert Cauwenberghs. Svm incremental learning, adaptation and optimization. In Proceedings of the 200 International Joint Conference on Neural Networks, pages 2685 2690, 200. Special series on Incremental Learning.