r - Error plotting SVM classification results for the spam dataset -
i having problem plotting results of svm
classification spam dataset kernlab
package..
code:
require(kernlab) data(spam) index <- sample(1:dim(spam)[1]) spamtrain <- spam[index[1:floor(dim(spam)[1]/2)], ] spamtest <- spam[index[((ceiling(dim(spam)[1]/2)) + 1):dim(spam)[1]], ] filter <- ksvm(type~.,data=spamtrain,kernel="rbfdot",kpar=list(sigma=0.05),c=5,cross=3) plot(filter, data=spamtrain)
error:
error in `[.data.frame`(expand.grid(lis), , labels(terms(x))) : undefined columns selected
from can tell, plot.ksvm
(which called when use plot
on ksvm
object) can plot objects 2 features, i.e., data matrix can have 2 columns. unfortunately, not mentioned anywhere in documentation, , spent couple of hours trying understand going wrong. don't know if planned fixed in future.
Comments
Post a Comment