我注意到svmRadial
中caret
的拟合函数实际上使用了lssvm
,但我认为正确的(预期的)方法应该是ksvm
。我错过了什么吗?
library(caret)
Loading required package: lattice
Loading required package: ggplot2
getModelInfo('svmRadial')[[1]]$fit
function(x, y, wts, param, lev, last, classProbs, ...) {
lssvm(x = as.matrix(x), y = y,
kernel = rbfdot,
kpar = list(sigma = param$sigma), ...)
}
getModelInfo('lssvmRadial')[[1]]$fit
function(x, y, wts, param, lev, last, classProbs, ...) {
lssvm(x = as.matrix(x), y = y,
kernel = rbfdot,
kpar = list(sigma = param$sigma), ...)
}
sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.3 (Yosemite)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] caret_6.0-47 ggplot2_1.0.1 lattice_0.20-31
答案 0 :(得分:0)
使用iris
数据集(R 3.2.0,kernlab_0.9-20,caret_6.0-47):
library(caret)
data(iris)
TrainData <- iris[,1:4]
TrainClasses <- iris[,5]
out1 <- train(TrainData, TrainClasses, method = "svmRadial")
# Loading required package: kernlab
class(out1$finalModel)
# [1] "ksvm"
# attr(,"package")
# [1] "kernlab"
out2 <- train(TrainData, TrainClasses, method = "lssvmRadial")
class(out2$finalModel)
# [1] "lssvm"
# attr(,"package")
# [1] "kernlab"
根据输出,似乎方法"svmRadial"
正在使用ksvm
包中的kernlab
。