正在加载图片...
Journal of Statistical Software 9 along with some utility functions commonly used in kernel-based methods like a quadratic programming solver,and modern kernel-based algorithms based on the functionality that the package provides.It also takes advantage of the inherent modularity of kernel-based methods, aiming to allow the user to switch between kernels on an existing algorithm and even create and use own kernel functions for the various kernel methods provided in the package. kernlab uses R's new object model described in "Programming with Data"(Chambers 1998) which is known as the S4 class system and is implemented in package methods.In contrast to the older S3 model for objects in R,classes,slots,and methods relationships must be declared explicitly when using the S4 system.The number and types of slots in an instance of a class have to be established at the time the class is defined.The objects from the class are validated against this definition and have to comply to it at any time.S4 also requires formal declarations of methods,unlike the informal system of using function names to identify a certain method in S3.Package kernlab is available from CRAN (http://CRAN.R-project. org/)under the GPL license. The ksvm()function,kernlab's implementation of SVMs,provides a standard formula inter- face along with a matrix interface.ksvm()is mostly programmed in R but uses,through the Call interface,the optimizers found in bsvm and libsvm (Chang and Lin 2001)which provide a very efficient C++version of the Sequential Minimization Optimization (SMO). The SMO algorithm solves the SVM quadratic problem (QP)without using any numerical QP optimization steps.Instead,it chooses to solve the smallest possible optimization prob- lem involving two elements of ai because the must obey one linear equality constraint.At every step,SMO chooses two oi to jointly optimize and finds the optimal values for these ai analytically,thus avoiding numerical QP optimization,and updates the SVM to reflect the new optimal values. The SVM implementations available in ksvm()include the C-SVM classification algorithm along with the v-SVM classification.Also included is a bound constraint version of C classi- fication(C-BSVM)which solves a slightly different QP problem(Mangasarian and Musicant 1999,including the offset B in the objective function)using a modified version of the TRON (Lin and More 1999)optimization software.For regression,ksvm()includes the e-SVM regres- sion algorithm along with the v-SVM regression formulation.In addition,a bound constraint version (e-BSVM)is provided,and novelty detection (one-class classification)is supported. For classification problems which include more then two classes (multi-class case)two options are available:a one-against-one (pairwise)classification method or the native multi-class formulation of the SVM(spoc-svc)described in Section 2.The optimization problem of the native multi-class SVM implementation is solved by a decomposition method proposed in Hsu and Lin (2002c)where optimal working sets are found (that is,sets of ai values which have a high probability of being non-zero).The QP sub-problems are then solved by a modified version of the TRON optimization software. The ksvm()implementation can also compute class-probability output by using Platt's prob- ability methods (Equation 8)along with the multi-class extension of the method in Wu et al. (2003).The prediction method can also return the raw decision values of the support vector model: library("kernlab") data("iris") irismodel <-ksvm(Species ~.data iris,Journal of Statistical Software 9 along with some utility functions commonly used in kernel-based methods like a quadratic programming solver, and modern kernel-based algorithms based on the functionality that the package provides. It also takes advantage of the inherent modularity of kernel-based methods, aiming to allow the user to switch between kernels on an existing algorithm and even create and use own kernel functions for the various kernel methods provided in the package. kernlab uses R’s new object model described in “Programming with Data” (Chambers 1998) which is known as the S4 class system and is implemented in package methods. In contrast to the older S3 model for objects in R, classes, slots, and methods relationships must be declared explicitly when using the S4 system. The number and types of slots in an instance of a class have to be established at the time the class is defined. The objects from the class are validated against this definition and have to comply to it at any time. S4 also requires formal declarations of methods, unlike the informal system of using function names to identify a certain method in S3. Package kernlab is available from CRAN (http://CRAN.R-project. org/) under the GPL license. The ksvm() function, kernlab’s implementation of SVMs, provides a standard formula inter￾face along with a matrix interface. ksvm() is mostly programmed in R but uses, through the .Call interface, the optimizers found in bsvm and libsvm (Chang and Lin 2001) which provide a very efficient C++ version of the Sequential Minimization Optimization (SMO). The SMO algorithm solves the SVM quadratic problem (QP) without using any numerical QP optimization steps. Instead, it chooses to solve the smallest possible optimization prob￾lem involving two elements of αi because the must obey one linear equality constraint. At every step, SMO chooses two αi to jointly optimize and finds the optimal values for these αi analytically, thus avoiding numerical QP optimization, and updates the SVM to reflect the new optimal values. The SVM implementations available in ksvm() include the C-SVM classification algorithm along with the ν-SVM classification. Also included is a bound constraint version of C classi- fication (C-BSVM) which solves a slightly different QP problem (Mangasarian and Musicant 1999, including the offset β in the objective function) using a modified version of the TRON (Lin and More 1999) optimization software. For regression, ksvm() includes the -SVM regres￾sion algorithm along with the ν-SVM regression formulation. In addition, a bound constraint version (-BSVM) is provided, and novelty detection (one-class classification) is supported. For classification problems which include more then two classes (multi-class case) two options are available: a one-against-one (pairwise) classification method or the native multi-class formulation of the SVM (spoc-svc) described in Section 2. The optimization problem of the native multi-class SVM implementation is solved by a decomposition method proposed in Hsu and Lin (2002c) where optimal working sets are found (that is, sets of αi values which have a high probability of being non-zero). The QP sub-problems are then solved by a modified version of the TRON optimization software. The ksvm() implementation can also compute class-probability output by using Platt’s prob￾ability methods (Equation 8) along with the multi-class extension of the method in Wu et al. (2003). The prediction method can also return the raw decision values of the support vector model: > library("kernlab") > data("iris") > irismodel <- ksvm(Species ~ ., data = iris
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有