Package svmpath. R topics documented: August 30, Title The SVM Path Algorithm Date Version Author Trevor Hastie

Similar documents
Package msgps. February 20, 2015

Package RAMP. May 25, 2017

Package PrivateLR. March 20, 2018

Package TANDEM. R topics documented: June 15, Type Package

Package glmnetutils. August 1, 2017

Package vinereg. August 10, 2018

Package glinternet. June 15, 2018

Support Vector Machines

Package logspline. February 3, 2016

Package rpst. June 6, 2017

SUPPORT VECTOR MACHINES

Package ordinalnet. December 5, 2017

Package DTRlearn. April 6, 2018

Package KERE. August 28, 2015

Chakra Chennubhotla and David Koes

Package listdtr. November 29, 2016

Package msda. February 20, 2015

Optimal Separating Hyperplane and the Support Vector Machine. Volker Tresp Summer 2018

Package mlegp. April 15, 2018

Package maboost. R topics documented: February 20, 2015

Package OLScurve. August 29, 2016

Package rfsa. R topics documented: January 10, Type Package

Package svalues. July 15, 2018

Module 4. Non-linear machine learning econometrics: Support Vector Machine

Package flam. April 6, 2018

Package penalizedlda

Package ridge. R topics documented: February 15, Title Ridge Regression with automatic selection of the penalty parameter. Version 2.

Lasso. November 14, 2017

Package SAM. March 12, 2019

Package flexcwm. May 20, 2018

Introduction to Support Vector Machines

Linear methods for supervised learning

Support Vector Machines

All lecture slides will be available at CSC2515_Winter15.html

Package hiernet. March 18, 2018

Package glmpath. R topics documented: January 28, Version 0.98 Date

Package dglm. August 24, 2016

Package naivebayes. R topics documented: January 3, Type Package. Title High Performance Implementation of the Naive Bayes Algorithm

The supclust Package

Package intccr. September 12, 2017

Support vector machines

Package SSLASSO. August 28, 2018

Package jtrans. August 29, 2016

Linear Methods for Regression and Shrinkage Methods

Package cwm. R topics documented: February 19, 2015

Package parcor. February 20, 2015

Package hgam. February 20, 2015

Package biglars. February 19, 2015

Kernel Methods & Support Vector Machines

Package AnDE. R topics documented: February 19, 2015

Package cosinor. February 19, 2015

Package datasets.load

Package gwrr. February 20, 2015

Support Vector Machines

Package kernelfactory

Package SiZer. February 19, 2015

Generative and discriminative classification techniques

Lecture 7: Support Vector Machine

Package pathclass. February 20, 2015

Package rgcvpack. February 20, Index 6. Fitting Thin Plate Smoothing Spline. Fit thin plate splines of any order with user specified knots

Classification by Support Vector Machines

Package bayescl. April 14, 2017

SUPPORT VECTOR MACHINES

Package lmesplines. R topics documented: February 20, Version

Package RLT. August 20, 2018

Package RCA. R topics documented: February 29, 2016

Package sbrl. R topics documented: July 29, 2016

Package nodeharvest. June 12, 2015

Package TVsMiss. April 5, 2018

DATA MINING INTRODUCTION TO CLASSIFICATION USING LINEAR CLASSIFIERS

Package rknn. June 9, 2015

Package mtsdi. January 23, 2018

Package glassomix. May 30, 2013

Data Analysis 3. Support Vector Machines. Jan Platoš October 30, 2017

Package sspline. R topics documented: February 20, 2015

Package OptimaRegion

Introduction to Machine Learning

Package GWRM. R topics documented: July 31, Type Package

Package PUlasso. April 7, 2018

Package ArCo. November 5, 2017

Package nonlinearicp

Package RaPKod. February 5, 2018

Package orthodr. R topics documented: March 26, Type Package

Package bayesdp. July 10, 2018

Package LINselect. June 9, 2018

Package corclass. R topics documented: January 20, 2016

Package lga. R topics documented: February 20, 2015

Support Vector Machines

Package pnmtrem. February 20, Index 9

COMS 4771 Support Vector Machines. Nakul Verma

Package CausalImpact

Package mnlogit. November 8, 2016

scikit-learn (Machine Learning in Python)

Support Vector Machines + Classification for IR

Package MixSim. April 29, 2017

Package areaplot. October 18, 2017

Package kirby21.base

Package PTE. October 10, 2017

Package maxnet. R topics documented: February 11, Type Package

6.867 Machine Learning

Transcription:

Title The SVM Path Algorithm Date 2016-08-29 Version 0.955 Author Package svmpath August 30, 2016 Computes the entire regularization path for the two-class svm classifier with essentially the same cost as a single SVM fit. Maintainer <hastie@stanford.edu> License GPL-2 URL http://www.jmlr.org/papers/volume5/hastie04a/hastie04a.pdf NeedsCompilation yes Repository CRAN Date/Publication 2016-08-30 01:55:19 R topics documented: balanced.overlap...................................... 2 plot.svmpath......................................... 2 predict.svmpath....................................... 4 print.svmpath........................................ 5 radial.kernel......................................... 6 summary.svmpath...................................... 7 svmpath........................................... 8 Index 11 1

2 plot.svmpath balanced.overlap simple examples for svmpath Datasets for illustrating the svmpath function, that can be plotted while its running Format In each case a list with a component x (t column matrix) and a component y (vector of +1/-1 values) "Balanced" refers to whether the number of +1s is the same as the -1s. "Overlap" indicates whether the classes are linearly separable. mixture.data is a balanced dataset with 100 observations in each class. The others are smaller with between 10-12 obs total. svmpath(x,y,trace=true,plot=true) plot.svmpath plot the svm solution at a step along the path produces a plot of the svm solution along the path, and optinally indicates support points ## S3 method for class 'svmpath' plot(x, step, Size = 60, elbow.show = TRUE, support.show = TRUE,...)

plot.svmpath 3 x step Size elbow.show support.show the svmpath object which step to plot; default is the last step. Use summary to see how many steps If the solution is non-linear, this is the gridsize for countour Should the points on the elbow be indicated Should the support points be indicated... additional arguments to plot, allowing one to change, for example, "main", "xlab" etc Details A two-dimensional plot is produced of the SVM solution. Makes sense only if X is two-dimensional. If not, the first two dimensions will be used A list is returned silently, with the ingredients of the plot coef.svmpath, svmpath, predict.svmpath, print.svmpath,summary.svmpath fit <- svmpath(x,y,trace=true,plot=false) plot(fit,step=2)

4 predict.svmpath predict.svmpath Make predictions from a "svmpath" object Provide a value for lambda, and produce the fitted lagrange alpha values. Provide values for x, and get fitted function values or class labels. ## S3 method for class 'svmpath' predict(object, newx, lambda, type = c("function", "class", "alpha", "margin"),...) object newx fitted svmpath object values of x at which prediction are wanted. This is a matrix with observations per row lambda the value of the regularization parameter. Note that lambda is equivalent to 1/C for the usual parametrization of a SVM type Details type of prediction, with default "function". For type="alpha" or type="margin" the newx argument is not required... Generic compatibility This implementation of the SVM uses a parameterization that is slightly different but equivalent to the usual (Vapnik) SVM. Here λ = 1/C. The Lagrange multipliers are related via αi = α i /λ, where αi is the usual multiplier, and α i our multiplier. Note that if alpha=0, that observation is right of the elbow; alpha=1, left of the elbow; 0<alpha<1 on the elbow. The latter two cases are all support points. In each case, the desired prediction.

print.svmpath 5 coef.svmpath, svmpath fit <- svmpath(x,y,trace=true,plot=true) predict(fit, lambda=1,type="alpha") predict(fit, x, lambda=.9) print.svmpath Print a summary of the SVM path print a summary of the fitted svmpath object ## S3 method for class 'svmpath' print(x, digits, maxsteps,...) x object to be printed digits number of significant digits (default 6) maxsteps the number of steps to print; default all... additional arguments to the generic print function For each step taken by the algorithm, one or more lines are printed. The step is described in terms of the observation number involved, a coded version of what happened, such as "L->E" meaning "from the Left set" to the "Elbow". Initially all the sets are empty. It gives the margin (sum of the xi), the size of the elbow, and the training error.

6 radial.kernel coef.svmpath, svmpath, predict.svmpath fit <- svmpath(x,y,trace=true,plot=true) print(fit) radial.kernel compute the kernel matrix for svmpath compute the kernel matrix for svmpath radial.kernel(x, y=x, param.kernel = 1/p,...) poly.kernel(x, y=x, param.kernel = 1,...) x an n x p matrix of features y an m x p matrix of features (if omitted, it defaults to x) param.kernel... unused the parameter(s) for the kernel. For this radial kernel, the parameter is known in the fields as "gamma". For the polynomial kernel, it is the "degree" Details For the radial kernel, this computes the function exp( γ x y 2 ) for each pair of rows x,y from the input matrices. Here g is param.kernel. For the polynomial kernel, it computes (xy T + 1) d, where d is param.kernel. An n x m matrix.

summary.svmpath 7 svmpath fit<-svmpath(x,y,kernel=radial.kernel) summary.svmpath produce a summary of an svmpath object printing an svmpath object can produce a lot of lines. The summary methods gives a more concise description by picking out a subset of the steps ## S3 method for class 'svmpath' summary(object, nsteps = 5, digits = 6,...) Details object nsteps digits the svmpath object usually omitted, but can be changed to get longer summaries number of significant digits... additional arguments to the generic summary function Uses the pretty function to extract the approximately the desired number of steps. Always includes the first and last step. returns a dataframe with the steps, value of lambda, training error, size of elbow, number of support points, and the sum of the overlaps

8 svmpath coef.svmpath, svmpath, predict.svmpath, print.svmpath fit <- svmpath(x,y,trace=true,plot=true) summary(fit) svmpath Fit the entire regularization path for a 2-class SVM The SVM has a regularization or cost parameter C, which controls the amount by which points overlap their soft margins. Typically either a default large value for C is chosen (allowing minimal overlap), or else a few values are compared using a validation set. This algorithm computes the entire regularization path (i.e. for all possible values of C for which the solution changes), with a cost a small (~3) multiple of the cost of fitting a single model. svmpath(x, y, K, kernel.function = poly.kernel, param.kernel = 1, trace, plot.it, eps = 1e-10, Nmoves = 3 * n, digits = 6, lambda.min = 1e-04,ridge=0,...) x y the data matrix (n x p) with n rows (observations) on p variables (columns) The "-1,+1" valued response variable. K a n x n kernel matrix, with default value K= kernel.function(x, x) kernel.function This is a user-defined function. Provided are poly.kernel (the default, with parameter set to default to a linear kernel) and radial.kernel param.kernel trace plot.it eps parameter(s) of the kernels if TRUE, a progress report is printed as the algorithm runs; default is FALSE a flag indicating whether a plot should be produced (default FALSE; only usable with p=2 a small machine number which is used to identify minimal step sizes

svmpath 9 Nmoves digits the maximum number of moves the number of digits in the printout lambda.min The smallest value of lambda = 1/C; default is lambda=10e-4, or C=10000 ridge Sometimes the algorithm encounters singularities; in this case a small value of ridge, around 1e-12, can help. Default is ridge=0... additional arguments to some of the functions called by svmpath. One such argument that can be passed is ridge (default is 1e-10). This is used to produce "stable" solutions to linear equations. Details The algorithm used in svmpath() is described in detail in "The Entire Regularization Path for the Support Vector Machine" by Hastie, Rosset, Tibshirani and Zhu (2004). It exploits the fact that the "hinge" loss-function is piecewise linear, and the penalty term is quadratic. This means that in the dual space, the lagrange multipliers will be pieceise linear (c.f. lars). a "svmpath" object is returned, for which there are print, summary, coef and predict methods. Warning Currently the algorithm can get into machine errors if epsilon is too small, or if lambda.min is too small. Increasing either from their defaults should make the problems go away, by terminating the algorithm slightly early. Note This implementation of the algorithm does not use updating to solve the "elbow" linear equations. This is possible, since the elbow changes by a small number of points at a time. Future version of the software will do this. The author has encountered numerical problems with early attempts at this. print, coef, summary, predict, and FilmPath

10 svmpath attach(unbalanced.separated) svmpath(x,y,trace=true,plot=true) ## Not run: svmpath(x,y,kernel=radial.kernel,param.kernel=.8)

Index Topic datasets balanced.overlap, 2 Topic regression plot.svmpath, 2 predict.svmpath, 4 print.svmpath, 5 radial.kernel, 6 summary.svmpath, 7 svmpath, 8 balanced.overlap, 2 balanced.separated (balanced.overlap), 2 mixture.data (balanced.overlap), 2 plot.svmpath, 2 poly.kernel (radial.kernel), 6 predict.svmpath, 4 print.svmpath, 5 radial.kernel, 6 summary.svmpath, 7 svmpath, 8 unbalanced.separated (balanced.overlap), 2 11