我使用Caret软件包来调优支持向量机模型。
在绘制结果时,是否有一种方法可以缩放与Sigma值类似的Cost值(如所附图所示)。
下面是我的调优值:
svmGrid <- expand.grid(sigma= 2^c(-25, -20, -15,-10, -5, 0), C= 2^c(0:5))生成情节的代码:
pdf("./Figures/svm/svmFit_all.pdf", width=7, height = 5)
trellis.par.set(caretTheme())
plot(svmFit.all, scales = list(x = list(log = 2)))
dev.off()谢谢

发布于 2015-08-28 19:03:43
你必须自己做,通过格子:
library(caret)
set.seed(1345)
dat <- twoClassSim(2000)
svmGrid <- expand.grid(sigma= 2^c(-25, -20, -15,-10, -5, 0), C= 2^c(0:5))
set.seed(45)
mod <- train(Class ~ ., data = dat,
method = "svmRadial",
preProc = c("center", "scale"),
tuneGrid = svmGrid,
metric = "ROC",
trControl = trainControl(method = "cv",
classProbs = TRUE,
summaryFunction = twoClassSummary))
tmp <- mod$results
tmp$sigma2 <- paste0("2^", format(log2(tmp$sigma)))
xyplot(ROC ~ C, data = tmp,
groups = sigma2,
type = c("p", "l"),
auto.key = list(columns = 4, lines = TRUE),
scales = list(x = list(log = 2)),
xlab = "Cost",
ylab = "ROC (Cross-Validation)")最大值
https://stackoverflow.com/questions/32260559
复制相似问题