scieee AI-readable full text Open interactive document viewer

Sparse methods for Online Support Vector Machine

Riera Molina, Carles Roger

Abstract

Aquest treball proposa un nou classificador online basat en Kernel SVM que minimitza el nombre de vectors de suport gràcies una restricció adicional imposada mitllançant métodes de continuació. Conseqüentment, es pot fer servir per solucionar problemes online de llarga escala.

Full text

FACULTAT D’INFORMÀTICA DE BARCELONA (FIB) FACULTAT DE MATEMÀTIQUES (UB) ESCOLA TÈCNICA SUPERIOR D’ENGINYERIA (URV) UNIVERSITAT POLITÈCNICA DE CATALUNYA (UPC) – BarcelonaTech UNIVERSITAT DE BARCELONA (UB) UNIVERSITAT ROVIRA i VIRGILI (URV) 24th November 2014 FACULTAT D’INFORMÀTICA DE BARCELONA (FIB) FACULTAT DE MATEMÀTIQUES (UB) ESCOLA TÈCNICA SUPERIOR D’ENGINYERIA (URV) UNIVERSITAT POLITÈCNICA DE CATALUNYA (UPC) – BarcelonaTech UNIVERSITAT DE BARCELONA (UB) UNIVERSITAT ROVIRA i VIRGILI (URV) 24th November 2014 Sparse methods for Online Support Vector Machine Carles R. Riera Molina Advisor: Oriol Pujol Vila PhD. Matemàtica Aplicada i Anàlisi Master in Artificial Intelligence SPARSE METHODS FOR ONLINE SUPPORT VECTOR MACHINE Carles R. Riera Molina 18 ECTS thesis submitted in partial fulfillment of a Magister Scientiarum degree in Artificial Intelligence Advisor Oriol Pujol Vila PhD. Faculty Representative Oriol Pujol Vila PhD. Faculty of Mathematics University of Barcelona Barcelona, November 2014 Sparse methods for Online Support Vector Machine Sparse methods for SVM 18 ECTS thesis submitted in partial fulfillment of a M.Sc. degree in Artificial Intelligence Copyright c 2014 Carles R. Riera Molina All rights reserved Faculty of Mathematics University of Barcelona University of Barcelona Gran Via, 585 08007 Barcelona, Barcelona Spain Telephone: 93 402 08 53 Bibliographic information: Carles R. Riera Molina, 2014, Sparse methods for Online Support Vector Machine, M.Sc. thesis, Faculty of Mathematics, University of Barcelona. Barcelona, Spain, November 2014 Per a la Laura i tot el que no va poder ser Abstract Support Vector Machine is a widely used classifier. Its well founded mathematical formulation, based on convex optimization framework, together with its nice generalization capabilities thanks to the implementation of the ideas from Structural Risk Minimization, perhaps lead to one of the most widely used classifiers in Machine Learning. Its non-linear extension is based in abstract vector spaces of functions called Reproducing Kernel Hilbert Spaces. By means of the so called kernel trick, that enables the possibility of projecting the data from the native space into a another space of high, possibly infinite, dimensionality, where the boundary is linear and thus, solvable by a linear Support Vector Machine. This allows to solve non-linear problems while enjoying all the mathematical guaranties and convergence bounds provided by the linear version. Since it is built on top of convex optimization, there are available the primal and the dual formulations. Traditionally, only the dual version was kernel capable, but recent work has enabled the possibility of using the kernel trick also in the primal, improving the convergence properties. However, both primal and dual versions suffer from the fact that their complexity is proportional to the number of support vectors, which is proved that it is linearly proportional to the size of the dataset. Recently, with the apparition of Internet and Big Data, new requirements have arisen for the old models. However, because Kernel SVM complexity in terms both of time and memory are proportional to the size of the problem, it is simply unfeasible to use with this kind of large-scale problems. This has lead to the fact that other models like Deep Neural Networks or Random Forest are used instead of SVM. There has been an increasing interest in the machine learning community to address those problems. In the early 2000’s the first attempts were made by the use of Reduced Set methods that try to build a model only with a subset of the support vectors. However, this only address the problem in testing, since a regular SVM need to be trained beforehand. Therefore, other approaches appeared, most of them based in clustering techniques and k-Nearest Neighbours, that could be applied before the training process. The results were quite promising, but the resulting models lose some of the desirable mathematical properties of the original SVM. Nevertheless, none of those models have become widely known and they have remained as a topic of research for academics. Another type of problems that have appeared with internet is the need for online models, models that can be trained continuously with a stream of intermittently arriving data. Even more, the distribution of the data can vary over the time, requiring the capability of forgetting what has been learnt until the point. Most of the most important SVM implementations use offline optimization algorithms, notably Platt’s Sequential Minimal Optimization and Interior Point Methods. Those v algorithms need the whole dataset to work, producing a solution that cannot be retrained, consequently are unsuitable for the task. Our proposal solves this issue by using another widely used algorithm that it is online capable called Stochastic Subgradient Method. Stochastic Subgradient Method is a generalization of Stochastic Gradient Descent that uses subgradient instead of gradient. The subgradient is a generalization of the gradient for non-differentiable functions. This is needed because the loss of the SVM is not differentiable. Two different state-of-the-art online classifiers are analyzed: Pegasos and NORMA. NORMA is an application of Stochastic Subgradient Method in the primal formulation. It reformulates the update step in such a way that only the last point sampled receives subgradient from the loss, improving convergence speed. Pegasos is another application of Stochastic Subgradient Methods but in a rather modified version of the primal, that by the use of a clever trick switching the decision function by a linear combination of subgradients of the loss, enhances the convergence bounds and allows the use of integer instead of the more costly float operations. Regarding support vector number reduction, we review the existing literature and extract the most important principles, intuitions and ideas that motivate and summarize the working principles of the existing methods. We summarize them in three main strategies, namely boundary, coverage, and error-based methods. Boundary methods try to keep only support vectors close to the boundary following the original spirit of SVM. Coverage techniques intent is to keep only support vectors that have high coverage over the space, and thus are able to subsume the contribution of other support vectors. And, finally, error-based strategies, where the supports are selected not regarding their geometry but choosing the ones that minimize the training error. We propose a novel method designed with the aim of overcoming the problems described before by merging an online learning algorithm from Pegasos and NORMA, a variation of Stochastic Subgradient Method, with a new method that tries to make use of the three strategies described before, in order to achieve a great reduction on the number of support vectors. With this, we expect to create a model able to deal with large-scale and online problems without the problems of the regular Kernel SVM. To do so, we use an additional set of constraints that force the weights to have a value over a given threshold or zero. We expect that enforcing those constraints we will obtain a model whose support vectors, since they have a high coefficient, have a high coverage, thus needing less amount of them to model the boundary. However, since we do not want to sacrifice accuracy for sparseness, we use Stochastic Subgradient Method, not only for being online capable, but also because it allows to dynamically add support vectors that, although they do not have a high coverage, are important regarding accuracy and error, since they are close to the boundary. We also review an vi sparse method called Separable Case Approximation, that tries to achieve sparsity by removing supports that are misclassified, considering that they do no offer any information that is not representable by the well classified support vectors. Training a model with those constraints is not trivial, because they are too hard to find a solution directly. Consequently, we use Continuation Methods and build an homotopy from the regular SVM formulation to the additional constrained one, by the use of a variable that increases the presence of the constraints iteratively. This fits nicely in the iterative nature of Stochastic Subgradient Method. In our case it consists in a variable threshold on the coefficient value that sets it to zero if it is below. It follows an exponential function, increasing the threshold quickly in the early stages of the training process to avoid to keep too many support vectors, and afterwards entering into a stationary fine-tunning phase. Finally, we validate our proposal and compare to other state-of-the-art offline and online classifier with a selection of datasets from the UCI respository. We compare both performance in terms of accuracy and number of support vectors. The results show great reduction of support vectors at almost no cost in accuracy, specially if the boundary is linear. We show the relation between sparsity and accuracy and how the decrement in support vectors is almost harmless for the performance. vii Notation The mathematical notation used throughout this document is described in this section. We represent functions and scalar variables by italicized lowercase letters, vectors by bold lowercase letters and matrices uppercase letters . When we refer to a component of a vector, subscript is used. For example, zirepresents the ith dimension of the vector z. A dataset Sis defined as a set of training examples S= (x1, y1), ..., (xn, yn), where each pair represents an individual xi∈Rdand its label yi∈ {−1,+1}l. xv Acknowledgments This work would have not been possible without the constant support, orientation, and engagement demonstrated by my advisor Oriol Pujol. He has become a source of knowledge and wisdom that has guided my struggle through the learning process of the Master Thesis. But preeminently he has been a example on personal quality and proximity. I would like also to acknowledge to my classmates who I shared pain and suffering with, during interminable journeys filling extensive and pointless reports, and who are like a family to me. Thank you for all I have learned from you, not only Machine Learning, specially Albert, Marc and Joan. However, this acknowledgment section would remain incomplete without a moment of gratefulness for a person who sadly is not anymore, but without her support in the most bitter moments I would have been unable to achieve any success. Thank you wherever you are. Finally, I would like to thank to all the academic community of Machine Learning and everyone who I had the pleasure to work with. Thank you all. xvii 1 Introduction Classification is the branch of the machine learning discipline devoted to build functions that map data to a set of labels. The data is the representation of a set of individuals, such as hospital patients or photographs, and the labels contain information that we want to recover for unseen individuals. For example, we can build a function that takes a text and returns the sentiment about it, whether it is positive or negative. In order to learn this mapping function we use algorithms that take a large set of data with its labels and return the function that better predicts the label for unseen elements. We call those functions models. One of the most widely used classifiers is Support Vector Machines, developed by Vapnik in the 90’s. SVM tries to find the best classifier considering a the notion of maximum margin separation between samples belonging to different classes. This problem can be formulated as a convex optimization problem. In convex optimization a problem is modelled by a convex objective function that we want to minimize/maximize and a set of affine equality constraints and a set of convex inequality constraints. SVM uses those constraints to formulate a function that for each point of the dataset must return the same sign than its label. Since there are many function that fulfill this condition, the one that maximinizes the distance between the classes is selected. It also introduces the notion of support vector, which are the points that contribute to the solution. The original formulation of SVM only consider lineal models. A non-linear extension was developed based in the concept of mapping the data into a higher dimensional space. This extension is known as Kernel SVM. However, by the use of this extension, the complexity of the classifier becomes proportional to the number of support vectors. Since the number of support vectors increases linearly with the size of the dataset, this causes that for large-scale problems the use of KSVM is simply unfeasible. This has lead to the use of other classifiers like Artificial Neural Networks or Random Forest that lack the notion of maximum separation hyperplane. Another equally important issue is online problems. Instead of the traditional setup where the data is available at once and the solution found is valid forever, we have that the data comes few at a time and the target distribution may change over the time. This renders all the very good optimization methods used to train the classifiers, like Interior point methods or Sequential Minimal Optimization (SMO) 1 1 Introduction not suitable anymore, since they work with all the data at once, and to retrain with the new data appeared they need to start all over. Consequently, in addition of having models being sparse we need them to be able of being retrained at any time. This work proposes a novel classifier to solve online and large-scale SVM problems with great efficiency due the heavy reduction of support vectors. In order to enjoy online capability we use a optimization algorithm called Stochastic Subgradient Method. For the support vector number reduction we use a set of additional constraints. Since those constraints are very hard, it is difficult to find a solution. To help it, we use continuation methods, building an homotopy from the original SVM formulation the final one with the additional constraints. An homotopy is a process where having a function that we can solve fand another that we cannot g, we build a process where iteratively solve h=µtf+ (1 −µt)g, for µy= 0,...,1. Since the increment of µtis small, we can easily find the solution of h. Finally, when µt= 1, then h=g, so we have solved the function that we were unable to solve at the beginning. In our case we start with the original formulation of SVM, without any additional constraints and successively tighten them until we reach our formulation with the sparsity constraints. This work is structured as follows: Chapter 2 introduces the basic SVM formulation and its adaptation to the online setting. First, we study the formulation from the perception to the kernel SVM in the primal. The learning algorithm which they are based, called Stochastic Subgradient Method, and its direct application to SVM is also analyzed. Afterwards, we review the literature to find the latest improvements in online SVM. This leads to the study of two popular models, Pegasos, [1], and NORMA, [2]. Chapter 3 reviews the topic of support vector reduction. In order to force the models discussed before to work with less support vectors, a review of the literature is performed, focusing in their basic intuitions and strategies in order to generalize them and adapt them to work in an online setup. Chapter 4 introduces our proposal based on a continuation method in the online SVM setting. The formulation is fully described and a study of the parameters involved is shown. Chapter 5 shows a set of experiments performed in order to validate our proposal, we conduct a comparison with six online and sparse state-of-the-art classifiers on a selection of the UCI datasets. We report both accuracy and number of support vectors. Chapter 6 states our conclusions together with our future work proposals. 2 2 Background on online support vector machines In this chapter we review the research on online learners. We start by recalling the perceptron, which is the most basic online classifier. Afterwards, we introduce Support Vector Machines, both in its linear and kernelized versions. Thereafter, we present Stochastic Subgradient Method (SSM), which is the optimization algorithm that it is used to train those models. Finally, we review two applications of SSM, the first is known as NORMA and the second is called Pegasos. We discuss the differences between them and the benefits and issues. 2.1 The first online learner: The perceptron Given a labeled training set of Npoints S={xi, yi}, where xi∈ Rdbelonging to class yi∈ {−1,+1}, i = 1 . . . M, we want a function f(·)the separating boundary between samples from one class and samples from the other class. One of the simplest models is called the Perceptron that models the boundary as a hyperplane. This is effectively computed as the sign function applied over a linear combination between a set of weights w∈ Rdand the features of x. It is a linear model, meaning that it splits the space in two halfs by the use of an hyperplane, assigning one label to each halfspace. f(x) = sign wTx+b A training or optimization process is the process used to find the optimal parameters of a model, in our case the weights, that make the model predict the best as possible. To do so, we need a measure of how well a classifier is performing. We call this a loss function L. This function usually takes as a parameter the original labels and the predictions, and returns an score for that prediction. The problem that we are solving expressed in the convex optimization framework is as follows. 3 2 Background on online support vector machines minimize w1 subject to yi( n X i=1 wixi+b)≥1, i = 1, . . . , m. The Perceptron formulation is enforcing is to find an hyperplane that separates our data in two classes. This hyperplane is encoded in the weight vector w. As we compute the inner product between the weights and the points we get, thanks to the sign, in which side of the hyperplane the point is. The offset bsimply moves around along the direction of w. But the problem is that in fact there may exist more than one hyperplane. For instance consider the simple separable problem in Fig. 2.1. 2 1 0 1 2 x 1 2.0 1.5 1.0 0.5 0.0 0.5 1.0 1.5 2.0 x 2 Simple Problem Figure 2.1: A simple problem. There is a huge space between this two classes. All the hyperplanes lying in that space separate perfectly the classes. This means that since we are in Rdthere are infinite of them. All of them are equally valid regarding the formulation. We can see some of them at Fig. 2.2. The problem is that not all the separating hyperplanes are equally good. We can expect, that, as the data is sampled from an unknown distribution, the unseen points will be closer to the already seen points of its class than the other. But with the Perceptron we may return an hyperplane that is too close to one of those classes and thus the probability of future errors increases. We should choose the hyperplane maximizing the distance to both classes, which will be in the middle of them. This is what the Support Vector Machine solves. 4 2.2 Support Vector Machines 3 2 1 0 1 2 3 x 1 2 1 0 1 2 x 2 Valid Perceptron hyperplanes Figure 2.2: Valid hyperplanes for the Perceptron. 2.2 Support Vector Machines As we previously saw in Section 2.1, we want to select the hyperplane that separates the data but additionally separates them with the maximum margin. The margin is the distance between the classes. To do so, we will cast this problem as a quadratic programming (QP). We wish to formulate our problem of finding the maximum margin hyperplane as a QP, which is a subtype of convex optimization problem. This formulation is known as Hard Margin Support Vector Machine. minimize w 1 2kwk2 2 subject to yi(wxi+b)≥1, i = 1, . . . , m. We use a set of constraints of the form yi(wxi+b)≥1, which means that we want that f(x)is at least one or minus one, regarding the class, or further. Our model is f(x) = wTx, so we know that the separating hyperplane is composed by all the points fulfilling the condition wTx= 0. Therefore, we have that wis the norm of this hyperplane. Since in the SVM formulation we have a constraint requiring that all the points have a value equal or greater than 1, the value of the closest points to the boundary, the support vectors, will be equal to 1. This causes that the effective distance from the support vectors to the margin is 1 kwk. Since we have two classes, the size of the margin becomes 2 kwk, 2.3. We want to maximize 5 2 Background on online support vector machines But since fkis found from the previous fk−1, we have that: fT= T X k ηk n X i l(f, xi, yi) If we move the sum over loutside, we get: fT= T X k n X i ηkl(f, xi, yi) What at the end means that as T goes to infinity: E[f] = E"∞ X k n X i ηkl(f, xi, yi)#=E"∞ X k ηkl(f, xi, yi)# Therefore, our update can be simplified to: fk+1 =fk−ηkl(f, xi, yi) Usually to determine ηkline search is used, but in the Machine Learning is more usual to use constant values or a monotonically decreasing function. In our case we will use one the inverse of the iteration ηk=1 k 2.5 State-of-the-art Online Kernel Machines In this section we review some of the most important online classifiers based on Primal Kernel SVM. We start with NORMA, a simple SSM application that enjoys good convergence properties, and finish with Pegasos, perhaps the most known SSM online kernel SVM at the moment. NORMA Norma [2], is an application of Stochastic Subgradient Method on the primal kernel SVM. It is based in the Representer theorem, therefore its form is: 12 2.5 State-of-the-art Online Kernel Machines minimize α 1 2λkαk2 2+ n X i ξi subject to yi( n X j=1 αiK(x, xj)) ≥1−ξi, i = 1, . . . , m. ξi≥0, i = 1, . . . , m. The update is modified so the subgradient it is only taken into account the iteration where a misclassified point appears, and the later iterations only serve to regularize. So a each update twe have: αt:= −ηt(−yk(xt)) for i=t αi:= −ηt(1 −ηtλ)αifor i<t The fact that it stores all the points seen as a support vectors increases redundancy, but it achieves a better convergence bound with error of ˜ O(1/(λ)2)with respect other SSM SVM solvers. The method to control the number of support vectors is simply maintain a buffer of size n, and if the buffer is full, make room by removing the older support vectors. Algorithm 1 NORMA algorithm Input: D, λ, T D: A dataset λ: Regularization parameter T: Number of iterations l: Loss function, hinge loss for SVM. α←0 for t= 1,2, . . . , T do Choose it∈ {0,...,|D|}]uniformly at random xt, yt←D[t] αj:= −ηtl0(ft(xt), yt),for j=it αk:= (1 −ηtλ)αi,for k < it end for Output: αT The NORMA algorithm is shown in Alg. 1. We initialize the coefficients to zero, then for each iteration we select randomly a point from the dataset. Then we add 13 2 Background on online support vector machines the point as a support vector, setting its weight to the loss subgradient. Afterwards, we regularize to the remaining coefficients by multiplying by a factor proportional to λ. Pegasos Pegasos, Primal Estimated sub-GrAdient SOlver for SVM [1], is another SSM application. It has interesting properties and clever ideas to improve performance. The model is the same as the Representer Theorem based for the primal kernel SVM, but with a sightly modification in the constraint. minimize α 1 2λkαk2 2+ n X i ξi subject to yi 1 tλ( n X j=1 αjyjK(x, xj)) ≥1−ξi, i = 1, . . . , m. ξi≥0, i = 1, . . . , m. By setting the learning rate ηto the inverse of the iteration by the regularization parameter, we get a convergence bound for a solution with error of ˜ O(1/(λ)), which is less than NORMA, but following [1] it seems that is very sensitive to the tuning of the learning rate, whereas Pegasos is used always the same. ηt=1 tλ This also has the very nice property that if a given support enters at iteration i, at the end the weight applied to the subgradient will be. 1 λi t Y j=i+1 j−1 j=1 λt So at the end, all the subgradient will be scaled by the same factor that depends on λ, which satisfies our intuition, since more regularized models will imply that the weight given to each support will be smaller. But the nice properties does not stop here, if we call to the subgradient at the iteration i,vi. 14 2.5 State-of-the-art Online Kernel Machines vi=−yik(xi) Therefore, we can decompose the vector αat iteration ton a sum of subgradients vimultiplied by a factor. αt=1 λt t X i=1 vi Furthermore, during the model traning, the more expensive float operations can be substituted by int operations if, instead of accumulating the subgradient into a vector in the traditional SSM solvers, computing αusing Eq. 2.5 and storing only the number of times that a given support appears misclassified. There is no mechanism to control the number of support vectors. Algorithm 2 Kernelized Pegasos algorithm Input: D, λ, T D: A dataset λ: Regularization parameter T: Number of iterations α←0 for t= 1,2, . . . , T do Choose it∈ {0,...,|D|}]uniformly at random For all j6=it, set αt+1[j] = αt[j] if yit 1 λt Pjαt[j]yitK(xit, xj)<1then αt+1[it] := αt[it]+1 else αt+1[it] := αt[it] end if end for Output: αT The Pegasos algorithm is shown in Alg. 2. First, αis set to zero. For each iteration a point is sampled randomly from the dataset. Then the point class is predicted, if the prediction is wrong, then the coefficient of that point is incremented by one. 15 3 Support Vector Number Reduction 3.1 State-of-the-art Sparse Support Vector Machines The academic community has developed a significant research in methods to speed up and simplify SVM. Several names have been given, reduced set methods, kernel expansion reduction, support vector number reduction, all of them have in common the pursue of a version of SVM with the minimum number of support vectors. Even though the reason for this research is to decrement the computational burden that SVM carries along, the particular reasons are different. Most of the early methods, such Burge’s Reduced Set [6], try to reduce the number of support vectors only for testing purposes, using the entire set of support vectors in the training. Other researchers want to reduce the number of support vectors also in the training, in order to speed up the fitting process, [7] [8] [9] . Finally, there is a renewed interest in those methods driven by the apparition of Big Data and large scale problems, which are simply unfeasible for traditional SVM. One can distinguish between main approaches to the problem, preprunning and postprunning, depending on it the result of a previous SVM is used. In the case of postprunning, the maximum amount of support vectors from the solution of the previously trained SVM are removed without harming the performance excessively. In the case of prepruning, the training algorithm itself selects or minimize the number of support vectors directly, maintaining an small number of support vectors during the training phase and thus enabling the use for large scale problems. Depending the objective one or other method is more suitable, or unsuitable at all. If the increase in performance is only desired for the testing phase, postprunning methods are simpler, but if speed in the training or a large problem are involved, then preprunning is needed. Since the intention is to develop models able to cope with large-scale problems, we only pay attention to preprunning methods. In those methods we can distinguish 17 3 Support Vector Number Reduction two different approaches, one is to preprocess the dataset removing redundant or meaningless data from the dataset, and the other is to build the set of support vectors dynamically during the training process. Our proposal belong to the latter set. 3.1.1 Approaches From an intuitive point of view we can classify all the methods in four different approaches, see Fig.3.1: Boundary, which tries to keep only points close to the other class; coverage, whose intent is to keep the points that are able to represent more data; error, methods that are driven by the traning error to determine if a point is suitable to be considered as a support vector and redundancy, that tries to remove points that do no offer new information. Approaches Geometry Coverage Boundary Heuristic Redundancy Additional term Linear combination Error Figure 3.1: Support vector number reduction main strategies. Boundary One of the most used strategies from the geometry family is to try to find the support vectors that are close to the boundary. Actually, Vapnik’s SVM states that the hypersurface can be expressed only with the points close to the boundary, so it is reasonable that removing the data points that lie far from the boundary should bring great improvements in terms of support vector reduction at no cost, since they do not contribute to the solution. The main approximation is to remove all the points that are far from the boundary and then train an SVM only with those points. Some use kNN to find those points, like [10] [11], others use clustering techniques to find clusters and then remove points close to the centroids or leave only the clusters that have data from both classes, like [8]. 18 3.1 State-of-the-art Sparse Support Vector Machines Coverage Coverage, also presented in literature as representer or center of the class, is the strategy consisting on keeping the support vectors that are able to represent more data points, this is, the support vectors that have more coverage. Under this approach we can find methods that make use of clustering techniques. They leave only the centroids, or the points close to them, or the centroids but with an increased weight to take into account the density of the cluster, like [12] [13] [14]. They expect that the remaining points will be able to express the same information that the entire cluster. Error Another strategy to choose support vectors is to consider to keep the ones that minimize the error. A good example is [15]. They use kernel expansion by the Representer’s Theorem. They interpret the kernel function over the points like basis functions, being the objective to find the optimal basis functions, where, since they are considered functions, now there is no need to be support vectors. A basis function (a support) is added iteratively in a greedy manner. To select the next basis function to approaches are used, the first is to perform an exhaustive search over the rest of data points and choose the one that reduces the maximum error, training again together all the previous functions. This is very expensive, so it can only be performed in a reduced set. A cheaper alternative is to fix the weights of the previous basis and optimize only the weight of the new basis. This is still top expensive to be carried on the entire dataset, so again a reduced set is used. Other approaches are researched, notably since finding the optimal support vector set is non-convex nor non-differentiable, genetic algorithms in [16]. Redundancy The methods that make use of this approach try to remove meaningless or redundant data from the dataset. In order to do so, several techniques are used, but they do not fit in the previous approaches. Linear combination This approach is very simple yet its results depend greatly on the dataset nature. Simply, they remove the points that are linear combination of other points, since they should be represented by only one of the points with a higher weight. For instance we can cite [17] or [18] 19 3 Support Vector Number Reduction Additional term They directly put an additional term on the QP formulation objective function. The terms usually are sums of the magnitude of the weights, like [19] or [20]. Another approach is to use different kinds of norm, involving usually l1,l∞or an interpolation of them, like [21]. 3.2 Separable Case Approximation In this section we review one of the most powerful Support Vector Reduction methods which is interesting because is not based in none of the previously described intuitions. Its source of support vector reduction is the misclassified ones. If we look at a noisy problem, we will find that there are many points that remain misclassified although the decision function is optimal. Those supports contribute to the solution, but the question is if they are really indispensable and their role can be fulfilled by another well classified support. Separable Case Approximation, SCA [22], is a method that propose remove those misclassified elements and solve the simplified problem resulting from it. To do so, first we fit a classifier with all the data, then we compute the loss of all the data regarding the classifier, this is sign(f(X)y), that will be positive if the predicted class is correct and negative if it is not. Then, we remove all the points that are misclassified and fit another classifier with the resulting data. The results should be similar, but we have a simpler problem and less support vectors. An example is shown in Fig. 3.2. The reduction is not extraordinary, but it is remarkable that it comes with no cost on the performance. Figure 3.2: Separable Case Approximation. The SVM trained with the original dataset used 1000 support vectors, whereas SCA used only 955. The drawback of this method is that instead of fitting one model, which take time 20 3.2 Separable Case Approximation depending on the problem, it is needed to fit two. Even more, since to be able to detect the misclassified problems a trained model is needed, it is not suitable to online problems. Finally, to determine if a support is misclassified it is needed to compute f(xi)yi, which implies the computation of a kernel expansion which can be costly to compute. 21 4 A continuation method for Very Sparse Support Vector Machines 0.95 = (1 −e−ρ0.95t T) Since k=t T: 0.95 = (1 −e−ρ0.95k) 0.05 = e−ρ0.95k We take logarithms in both sides: ln(0.05) = ln(e−ρ0.95 k) ln(0.05) = −ρ0.95k ρ0.95 =−ln(0.05) k(4.4) Finally we get that ρis the logarithm of 0.05 multiplied by the total number of iterations, and divided by k, see 4.4. The result of this is shown in Fig. 4.2, where we can see the values of µtover the iterations for different values of ρ, corresponding to 25%, 50% and 75%. We can see how for each increasing value of ρthe level of µt= 0.95 is reached sooner. 28 4.3 Our approach 0 10000 20000 30000 40000 50000 0.0 0.2 0.4 0.6 0.8 1.0 0 . 95 θ ρ =3 ρ =6 ρ =9 Figure 4.2: µtover iteration for different values of ρ. 4.3 Our approach Our proposal is based in three of those intuitions: Boundary, coverage and error. The most clear one is coverage, since we are removing supports with small coefficients. Therefore the support vectors remaining will have high coverage due their high weight. Since the weight is given by the loss subgradient, which is the label multiplied by the kernel expansion. The amount of weight will be proportional to the kernel expansion, which is the distance to the point that has been misclassified. Therefore, points that are far from the other points, and thus have not much coverage, will receive less subgradient and will be more suitable to be pruned. However, there are points that may have low coverage but they are important because they model a part of the boundary with additional resolution. Those points would be pruned by the coverage strategy, but since they are important to model their local area of the boundary, their miss will cause errors, and the error will generate subgradient that will compensate their lack of coverage, thus making them unsuitable to be pruned. There is a kind of trade-off, of complementary work between both strategies. 29 4 A continuation method for Very Sparse Support Vector Machines Since the mechanism to combine coverage and boundary is the subgradient, and the subgradient is generated by the errors of each iteration of the SSG, we can affirm that our proposal also takes in consideration the error strategy. 30 5 Results In this section we validate our proposal quantitatively by performing a set of experiments on different datasets from the standard UCI database. 5.1 Parameter analysis This section is devoted to investigate the behavior of the parameters of our proposal. We have two parameters, the first is θcontrols the degree of sparsity desired of the solution, the second is ρ, that controls the aggressivity, how fast we move through the homotopy and how many iterations are devoted to finetune the model. We will see how those parameters affect to the number of support vectors and the accuracy. For this purpose four datasets from the UCI database have been selected, their size, dimensionality and class distribution is shown in Table 5.1. Size Dimensionality Class distribution diabetes_scale 768 8 0.35/0.65 breast-cancer 683 10 0.65/0.35 heart 270 13 0.56/0.44 liver-disorders 345 6 0.42/0.58 Table 5.1: Datasets used for the parameter analysis together with their size, dimensionality and class distribution . 5.1.1 Aggressivity analysis In this section we will research how the parameter ρaffects to the outcome of the solver. In Fig. 5.1 we show the result of an experiment where the number of iterations is set to T= 50000, and different values of aggressivity ρ0.95 ∈1,3,6,9are tested, 31 5 Results corresponding to reaching µt= 0.95 at 300%, 100%, 50%, 33% respectively. We can see clearly how the number of supports reaches a peak close to the start and afterwards it decreases until convergence into similar numbers of supports for all the cases. The effect of ρis easy to see: For each increasing value of ρthe curve is almost perfectly scaled from the previous value. This demonstrates the relation between kand ρdiscussed before, since the difference between the curves is almost proportional to the difference of the values of ρ. We can see the curves equally spaced between them. 0 20000 40000 60000 80000 100000 Iteration 0 20 40 60 80 100 #Support vectors Breast cancer ρ =1 ρ =3 ρ =6 ρ =9 0 20000 40000 60000 80000 100000 Iteration 0 20 40 60 80 100 120 140 160 180 #Support vectors Heart ρ =1 ρ =3 ρ =6 ρ =9 0 20000 40000 60000 80000 100000 Iteration 0 20 40 60 80 100 120 140 160 #Support vectors Diabetes scale ρ =1 ρ =3 ρ =6 ρ =9 0 20000 40000 60000 80000 100000 Iteration 0 50 100 150 200 250 300 #Support vectors Liver disorders ρ =1 ρ =3 ρ =6 ρ =9 Figure 5.1: Number of support vectors vs. iteration for various values of ρ. 5.1.2 Theta analysis Regarding θ, the parameter that controls sparsity, we can see in the Fig. 5.2 an experiment consisting in training a model with different values of θand a low value of ρto ensure convergence. 32 5.1 Parameter analysis 0 20000 40000 60000 80000 100000 Iteration 0 50 100 150 200 250 300 350 #Support vectors Liver disorders θ =0 . 1 θ =0 . 33 θ =0 . 66 θ =1 0 20000 40000 60000 80000 100000 Iteration 0 20 40 60 80 100 120 140 160 180 #Support vectors Heart θ =0 . 1 θ =0 . 33 θ =0 . 66 θ =1 0 20000 40000 60000 80000 100000 Iteration 0 20 40 60 80 100 120 #Support vectors Breast cancer θ =0 . 1 θ =0 . 33 θ =0 . 66 θ =1 0 20000 40000 60000 80000 100000 Iteration 0 20 40 60 80 100 120 140 160 #Support vectors Diabetes scale θ =0 . 1 θ =0 . 33 θ =0 . 66 θ =1 Figure 5.2: Number of support vectors vs. iteration for various values of theta. We can appreciate how the magnitude of θaffects the number of support vectors of the model, starting with a peak at the beginning and converging to the final amount of support vectors. This is expected, since this final value of support vectors shows that the model has achieved a point where all the support vector weights are above the threshold θ, so none of them is pruned. The peak is similar to the one observed in the experiments of Section 5.1.1. We understand that they are due the fact that the model is still converging to an approximate solution, and it has not started to prune yet. Furthermore, we can see how for θ= 5, the threshold is to high, so all the support vectors are pruned, thus converging to zero. This is normal and shows that there is not any solution fulfilling sparsity constraint. We will see later how this affect to the accuracy in Section 5.1.3. 33 5 Results 5.1.3 Performance analysis In this section we will review the behavior of the parameters with respect accuracy. In Fig. 5.3 we can see an experiment consisting in training our model with three different values of ρ, generating three curves, along eight equally spaced values for θ, from 0.1 to 2 in the abscissa axis and the accuracy achieved in the ordinate axis, estimated through a 5-fold cross-validation. The number of iterations is set to 50000. 0 1 2 3 4 5 6 Theta 0.0 0.2 0.4 0.6 0.8 1.0 Accuracy Heart ρ =2 ρ =4 ρ =6 0 1 2 3 4 5 6 Theta 0.0 0.2 0.4 0.6 0.8 1.0 Accuracy Breast cancer ρ =2 ρ =4 ρ =6 0 1 2 3 4 5 6 Theta 0.0 0.2 0.4 0.6 0.8 1.0 Accuracy Liver disorders ρ =2 ρ =4 ρ =6 0 1 2 3 4 5 6 Theta 0.0 0.2 0.4 0.6 0.8 1.0 Accuracy Diabetes scale ρ =2 ρ =4 ρ =6 Figure 5.3: Accuracy vs. θfor various values of ρ. We can see how for all the values of aggressivity the accuracy is constant for low values and it gets degradated as far θincreases. In some cases, like ρ= 2 in breast cancer the degradation does not occur. This is normal since the higher θis, the more restrictive the sparsity constraint is, so there is not any solution for that level of sparseness. Another interesting point is the fact that in most of the cases ρhas no impact in the accuracy. This means that it is not a critical parameter, and its effect it is only 34 5.2 Experimental settings related to the size of the initial peak of support vectors, as we saw in Section 5.1.1. 5.2 Experimental settings In this section we expose the methodological settings used in the experiments. For the comparison we have chosen a set of state of the art classifiers based on SVM, both online and offline capable. The chosen classifiers are: RBF-SVM from libSVM, which is based in Platt’s SMO; SCA, which uses libSVM as backend; SSM based RBF-SVM, Pegasos, NORMA, and our proposal all of them implemented by ourselves and available at https://github.com/blauigris/svm. Datasets Table 5.2 shows the size, dimensionality and class distribution of the selected datasets. All of them are from the UCI repository. There are small to medium sized datasets, ranging from 200 to 1385. The dimensionality dranges from 6 to high dimensionality 7129. The class distribution is quite balanced All the datasets are standardized to µ= 0 and σ= 1. Size Dimensionality Class distribution breast cancer 683 10 0.65/0.35 ionosphere 351 34 0.36/0.64 sonar 208 60 0.53/0.47 diabetese 768 8 0.35/0.65 liver-disorders 345 6 0.42/0.58 heart 270 13 0.56/0.44 colon cancer 62 2000 0.65/0.35 duke breast cancer 86 7129 0.48/0.52 mg 1385 6 0.55/0.45 Table 5.2: Datasets used in the experiment together with the size, dimensionality and class distribution Performance measures The performance measure selected is the accuracy score, which is the number of correct predictions over the total number of samples. accuracy(y, ˆy) = 1 n n−1 X i=0 1(ˆyi=yi) 35 5 Results Methodology In order to get an estimation of the out-of-sample accuracy of the models, we use a 5-fold cross-validation scheme. Since all the models are version of SVM, we have two hyperparameters to optimize: λand γ. We perform a grid search over five values of each parameter. In the case of our proposal, where we have two additional parameters, an additional grid search is carried for each combination of λand γ, with five values for θand two for ρ, since we consider that θis more important than ρ, as we show in Section 5.1. Table 5.3 shows the concrete values used for each dataset. γ λ breast cancer 0.01, 0.05, 0.1, 0.5, 1 0.001, 0.005, 0.01, 0.05, 0.1 diabetes 0.005, 0.01, 0.05, 0.1, 0.5 0.001, 0.005, 0.01, 0.05, 0.1 duke breast cancer 0.005, 0.01, 0.05, 0.1, 0.5 0.001, 0.005, 0.01, 0.05, 0.1 heart 0.01, 0.05, 0.1, 0.5, 1 0.001, 0.005, 0.01, 0.05, 0.1 ionosphere 0.005, 0.01, 0.05, 0.1, 0.5 0.001, 0.005, 0.01, 0.05, 0.1 liver disorders 0.1, 0.5, 1, 5, 10 0.001, 0.005, 0.01, 0.05, 0.1 mg 0.01, 0.05, 0.1, 0.5, 1 0.001, 0.005, 0.01, 0.05, 0.1 sonar 0.005, 0.01, 0.05, 0.1, 0.5 0.001, 0.01, 0.1, 1, 10 Table 5.3: λand γvalues used for each dataset The values of θand γare the same for all the datasets: ρ θ 3, 6 0.05,0.5, 1, 2, 4 Table 5.4: ρand θvalues used for each dataset The number of iterations for Stochastic Subgradient Methods based models, included our proposal, is 50000. Following Section 5.1.1, the selected ρvalues mean that training will reach 0.95θat k0.95 ={0.5,1}. 5.3 Results This section is devoted to compare the performance between the selected models on the datasets. We will compare the models both in terms of accuracy and number of support vectors, Table 5.7. 36 5.3 Results Pegasos Pegasos SV NORMA NORMA SV OnlineSVM OnSVM SV OnlineSCA OnSCA SV breast cancer 0.973646 ◦473 ◦0.964861 5000 0.972182 153 0.972182 227 diabetes 0.759115 570 ◦0.740885 5000 0.757812 ◦667 0.753906 324 duke breast cancer ◦0.895349 ◦397 - - 0.988372 91 - - heart 0.848148 ◦262 ◦0.833333 5000 0.859259 215 0.844444 220 ionosphere ◦0.846154 178 0.860399 5000 0.874644 219 0.837607 ◦263 liver disorders 0.669565 341 ◦0.623188 5000 0.666667 ◦338 0.634783 221 mg 0.846209 ◦1385 ◦0.829603 5000 0.857040 1347 0.845487 1060 sonar 0.548077 ◦208 0.591346 5000 0.548077 ◦208 0.538462 174 SCA SCA SV SVC SVC SV VSSVM VSSVM SV breast cancer 0.970717 43 0.970717 79 0.966325 13.6 diabetes 0.774740 173 0.772135 425 0.748698 9.2 duke breast cancer 0.988372 44 0.988372 44 0.988372 43.6 heart 0.837037 128 0.837037 157 0.837037 12.8 ionosphere 0.951567 133 0.945869 149 0.854701 20.0 liver disorders 0.730435 102 0.730435 241 0.681159 53.2 mg 0.853430 104 0.852708 558 0.833935 15.8 sonar ◦0.533654 ◦208 ◦0.533654 ◦208 0.629808 4.0 Table 5.7: Results of the validation on the UCI datasets in terms of accuracy and number of support vectors for each classifier. 37 6 Conclusions In this work we have proposed a continuation method for online SVM for achieving very large sparsity. We show that giving priority to the supports with higher coefficients has no negative effects on the performance of the classifier. We find that this has interesting semantical and philosophical implications, first in how the SSM is biased towards solutions with less supports, traversing the parameter space in a different direction due the pruning of support vectors. Also, the homotopy formulation of our approach helps us to understand its effect beyond the algorithmic point of view, establishing a well established mathematical formulation. From the analysis of the literature realized in Section 3.1 we present a version of SVM that, starting from the traditional principle that states that the most important points to define the boundary are the ones close to it, we expand this formulation to incorporate an additional constraint that forces the presence of points that are far from the boundary but, because of this, they are able to reach more areas of the space. We understand that each kind of point, the boundary support vector and the coverage support vector, play their role and that a trade-off between them is important. This is the reason why developing a training algorithms that by the use of Stochastic Subgradient Methods, with its online capability as a side profit, and a continuation scheme based on homotopies, is important to reach this trade-off. The results show a competitive performance regarding accuracy and an unmatched support vector number reduction, far from other methods as SCA. However there are some drawbacks. With our modifications the problem ceases being convex, so the quality of the solution may depend in the order which the supports enter into the SVM. Also, there are cases where a solution may not exist, for instance when the sparseness requeriments are too hard, by setting a high value of θ, or there is too few iterations devoted to traverse the homotopy, when the ρis too hard. We believe that this work points in the direction of new variation of the Vapnik–Chervonenkis dimension, where the dimension is not directly involved with the number of points that a classifier can separate, but how the number of points that 45 6 Conclusions a classifier can separate is directly related to the number of support vectors in the case of the SVM. Therefore, as we have seen in the experiments, we can expect that the number of supports is proportional to the complexity and dimensionality of the problem. Finally, the reduction in the kernel expansion enables to use other norms based in quadratic forms, like k·kH. Also, the small size of the gram matrix allow to the use of second order methods like Newton that require to much memory to store the Hessian for regular SVM. 6.1 Future work As a future work topics we consider: Subgradient Weighting Another possible mechanism to apply the same strategy of VSSVM is, instead of using an homotopy, weight the subgradient of the loss, which is what increases the coefficients, in such a way that prioritize support vectors with high coverage. To do so, we use a vector of weights that bias the subgradient during the training process. Regularization The same intuition about penalizing small coefficients can be applied by the use of a penalizing term in the problem formulation. With this we get a closer representation to the original convex optimization, switching the traditional equal-to-all regularization, by one that it softer with high coefficients and more aggressive with low ones. The idea is to try to penalize the supports with small coefficients directly in the objective function. With this, we get like a sort of biased regularization where we try to regularize the weights with more emphasis in the small ones. Analysis and convergence bounds A more formal analysis is worth in the subject of convergence, proofing convergence bounds and researching the effects of those algorithms on the traversal of the parameter space. Furthermore, it would be interesting to find the connection between all them beyond the initial intuition and also try to visualize their effects from a geometric point of view. Distance to the boundary Finally, another topic of interest that we consider worth to explore is to use different heuristics from the one we have used in this 46 6.1 Future work work, like penalizing supports far from the boundary, supports with weak coverage or use reconstruction error as autoencoders do. Probably a combination of them may lead to a better selection of the kernel expansion. Cumulative error as a Out-of-sample error estimate Since those algorithms are designed to be able to work in an online setup, it may be troublesome to tune the hyperparameters. Hence, a way to tune them needs to be devised. Our approximation to this question is to, since every time that we see a new point at each iteration of SSM, it is unknown to the current model, thus being an estimator of the out-of-sample error. We can track the number of errors until the current iteration and use it to compute the subgradient with respect the hyperparameter, assuming convexity. 47 Bibliography [1] S. Shalev-Shwartz, Y. Singer, N. Srebro, and A. Cotter, “Pegasos: Primal estimated sub-gradient solver for svm,” Mathematical programming, vol. 127, no. 1, pp. 3–30, 2011. [2] J. Kivinen, A. J. Smola, and R. C. Williamson, “Online learning with kernels,” Signal Processing, IEEE Transactions on, vol. 52, no. 8, pp. 2165–2176, 2004. [3] C. Cortes and V. Vapnik, “Support-vector networks,” Machine learning, vol. 20, no. 3, pp. 273–297, 1995. [4] O. Chapelle, “Training a support vector machine in the primal,” Neural Computation, vol. 19, no. 5, pp. 1155–1178, 2007. [5] B. Schölkopf, R. Herbrich, and A. J. Smola, “A generalized representer theorem,” in Computational learning theory, pp. 416–426, Springer, 2001. [6] C. J. Burges et al., “Simplified support vector decision rules,” in ICML, vol. 96, pp. 71–77, 1996. [7] S.-X. Lu, J. Meng, and G.-E. Cao, “Support vector machine based on a new reduced samples method,” in Machine Learning and Cybernetics (ICMLC), 2010 International Conference on, vol. 3, pp. 1510–1514, IEEE, 2010. [8] R. Koggalage and S. Halgamuge, “Reducing the number of training samples for fast support vector machine classification,” Neural Information Processing- Letters and Reviews, vol. 2, no. 3, pp. 57–65, 2004. [9] Y.-J. Lee and S.-Y. Huang, “Reduced support vector machines: A statistical theory,” Neural Networks, IEEE Transactions on, vol. 18, no. 1, pp. 1–13, 2007. [10] N. Panda, E. Y. Chang, and G. Wu, “Concept boundary detection for speeding up svms,” in Proceedings of the 23rd international conference on Machine learning, pp. 681–688, ACM, 2006. [11] F. Angiulli and A. Astorino, “Scaling up support vector machines using nearest neighbor condensation,” Neural Networks, IEEE Transactions on, vol. 21, no. 2, pp. 351–357, 2010. 49 BIBLIOGRAPHY [12] M. Barros de Almeida, A. de Pádua Braga, and J. P. Braga, “Svm-km: speeding svms learning with a priori cluster selection and k-means,” in Neural Networks, 2000. Proceedings. Sixth Brazilian Symposium on, pp. 162–167, IEEE, 2000. [13] Q.-A. Tran, Q.-L. Zhang, and X. Li, “Reduce the number of support vectors by using clustering techniques,” in Machine Learning and Cybernetics, 2003 International Conference on, vol. 2, pp. 1245–1248, IEEE, 2003. [14] S. L. Phung, G. H. Nguyen, and A. Bouzerdoum, “Efficient svm training with reduced weighted samples,” 2010. [15] S. S. Keerthi, O. Chapelle, and D. DeCoste, “Building support vector machines with reduced classifier complexity,” The Journal of Machine Learning Research, vol. 7, pp. 1493–1515, 2006. [16] M. F. A. Hady, W. Herbawi, M. Weber, and F. Schwenker, “A multi-objective genetic algorithm for pruning support vector machines,” in Tools with Artificial Intelligence (ICTAI), 2011 23rd IEEE International Conference on, pp. 269– 275, IEEE, 2011. [17] T. Downs, K. E. Gates, and A. Masters, “Exact simplification of support vector solutions,” The Journal of Machine Learning Research, vol. 2, pp. 293–297, 2002. [18] X. Liang, “An effective method of pruning support vector machine classifiers,” Neural Networks, IEEE Transactions on, vol. 21, no. 1, pp. 26–38, 2010. [19] P. M. Drezet and R. F. Harrison, “A new method for sparsity control in support vector classification and regression,” Pattern Recognition, vol. 34, no. 1, pp. 111– 125, 2001. [20] S.-Y. Chiu, L.-S. Lan, and Y.-C. Hwang, “Two sparsity-controlled schemes for 1-norm support vector classification,” in Circuits and Systems, 2007. NEWCAS 2007. IEEE Northeast Workshop on, pp. 337–340, IEEE, 2007. [21] O. Dekel and Y. Singer, “Support vector machines on a budget,” Advances in neural information processing systems, vol. 19, p. 345, 2007. [22] D. Geebelen, J. A. Suykens, and J. Vandewalle, “Reducing the number of support vectors of svm classifiers using the smoothed separable case approximation,” Neural Networks and Learning Systems, IEEE Transactions on, vol. 23, no. 4, pp. 682–688, 2012. [23] C. Simó, “On the analytical and numerical approximation of invariant manifolds.,” in Les Méthodes Modernes de la Mécanique Céleste. Modern Methods in Celestial Mechanics, vol. 1, pp. 285–329, 1990. 50