我正在学习如何使用kernlab中的ksvm进行分类。我试过一些例子(如虹膜等)。然而,当我尝试处理我的数据时,我总是得到一个错误:
rbfdot(length = 4,lambda = 0.5)中出错:未使用的参数(length = 4,lambda = 0.5)
如果有人能指出哪里出了问题,或者给我指给我适当的文档,我真的很感激。
附件是我的数据文件。
DataFile:http://www.mediafire.com/view/?todfg2su1qmw18n
我的R代码:
id = "100397.txt"
dat <- read.table(id, header=FALSE,sep = ",")
n = nrow(dat) # number of data points
numCol = ncol(dat)
dat <- dat[,-c(numCol)] ### get rid of the last column because it is not useful.
numCol = ncol(dat) ### update the number of columns
ntrain <- round(n*0.8) # get 80% of data points for cross-validation training
tindex <- sample(n,ntrain) # get all indices for cross-valication trainining
xtrain <- dat[tindex,-c(numCol)] # training data, not include the class label
xtest <- dat[-tindex,-c(numCol)] # test data, not include the class label
ytrain <- dat[tindex,c(numCol)] # class label for training data
ytest <- dat[-tindex,c(numCol)] # class label for testing data
nrow(xtrain)
length(ytrain)
nrow(xtest)
length(ytest)
### SVM function ###
svp <- ksvm(xtrain, ytrain, type="C-bsvc", kernel='rbf', C = 10, prob.model=TRUE)
发布于 2012-10-08 13:21:45
查看rbfdot
的文档,该函数既没有输入参数length
,也没有lambda
,而这正是错误消息所说的。内核函数stringdot
确实有这些参数,但没有sigma
参数。要生成内核,可以更仔细地查看at the documentation。
https://stackoverflow.com/questions/12774845
复制相似问题