正在加载图片...
Journal of Statistical Software 11 class(k)<-"kernel" data("promotergene") gene <-ksvm(Class ~.data promotergene, kernel =k,C=10,cross =5) gene Support Vector Machine object of class "ksvm" SV type:C-svc (classification) parameter cost C =10 Number of Support Vectors 66 Training error 0 Cross validation error 0.141558 The implementation also includes the following computationally efficiently implemented ker- nels:Gaussian RBF,polynomial,linear,sigmoid,Laplace,Bessel RBF,spline,and ANOVA RBF. N-fold cross-validation of an SVM model is also supported by ksvm,and the training error is reported by default. The problem of model selection is partially addressed by an empirical observation for the popular Gaussian RBF kernel (Caputo,Sim,Furesjo,and Smola 2002),where the optimal values of the width hyper-parameter o are shown to lie in between the 0.1 and 0.9 quantile of the -z2 statistics.The sigest()function uses a sample of the training set to estimate the quantiles and returns a vector containing the values of the quantiles.Pretty much any value within this interval leads to good performance. The object returned by the ksvm()function is an S4 object of class ksvm with slots containing the coefficients of the model (support vectors),the parameters used (C,v,etc.),test and cross-validation error,the kernel function,information on the problem type,the data scaling parameters,etc.There are accessor functions for the information contained in the slots of the ksvm object. The decision values of binary classification problems can also be visualized via a contour plot with the plot()method for the ksvm objects.This function is mainly for simple problems. An example is shown in Figure 1. x <-rbind(matrix(rnorm(120),,2),matrix(rnorm(120, +mean=3),,2) >y<-matrix(c(rep(1,60),rep(-1,60))) svp <-ksvm(x,y,type "C-svc",kernel "rbfdot", kpar list(sigma =2)) plot(svp) 5.svm in e1071 Package e1071 provides an interface to libsvm (Chang and Lin 2001,current version:2.8),Journal of Statistical Software 11 > class(k) <- "kernel" > data("promotergene") > gene <- ksvm(Class ~ ., data = promotergene, + kernel = k, C = 10, cross = 5) > gene Support Vector Machine object of class "ksvm" SV type: C-svc (classification) parameter : cost C = 10 Number of Support Vectors : 66 Training error : 0 Cross validation error : 0.141558 The implementation also includes the following computationally efficiently implemented ker￾nels: Gaussian RBF, polynomial, linear, sigmoid, Laplace, Bessel RBF, spline, and ANOVA RBF. N-fold cross-validation of an SVM model is also supported by ksvm, and the training error is reported by default. The problem of model selection is partially addressed by an empirical observation for the popular Gaussian RBF kernel (Caputo, Sim, Furesjo, and Smola 2002), where the optimal values of the width hyper-parameter σ are shown to lie in between the 0.1 and 0.9 quantile of the kx − x 0k 2 statistics. The sigest() function uses a sample of the training set to estimate the quantiles and returns a vector containing the values of the quantiles. Pretty much any value within this interval leads to good performance. The object returned by the ksvm() function is an S4 object of class ksvm with slots containing the coefficients of the model (support vectors), the parameters used (C, ν, etc.), test and cross-validation error, the kernel function, information on the problem type, the data scaling parameters, etc. There are accessor functions for the information contained in the slots of the ksvm object. The decision values of binary classification problems can also be visualized via a contour plot with the plot() method for the ksvm objects. This function is mainly for simple problems. An example is shown in Figure 1. > x <- rbind(matrix(rnorm(120), , 2), matrix(rnorm(120, + mean = 3), , 2)) > y <- matrix(c(rep(1, 60), rep(-1, 60))) > svp <- ksvm(x, y, type = "C-svc", kernel = "rbfdot", + kpar = list(sigma = 2)) > plot(svp) 5. svm in e1071 Package e1071 provides an interface to libsvm (Chang and Lin 2001, current version: 2.8)
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有