为SVM运行火车功能并指定网格时:
ctrl <- trainControl(method = "repeatedcv", number = 10, repeats = 50, verboseIter = TRUE,
savePredictions = TRUE, classProbs = TRUE, summaryFunction = MySummary)
SVMgrid <- expand.grid(sigma = seq(0.0025,0.03,0.0025), C = seq(0.5,20,2))
mod_fit <- train(Thrombosis ~ ., data=df, method="svmRadial", trControl=ctrl,
tuneGrid=SVMgrid, preProc=c("scale","YeoJohnson"), metric="Kappa",
allowParallel = TRUE)
输出是一个对象,该对象在指定的网格上具有所需指标的值:
> res$model$results
sigma C Accuracy Kappa
1 0.0025 0.5 0.9133391 0.1749249
2 0.0025 2.5 0.9138762 0.2059130
3 0.0025 4.5 0.9183870 0.2710625
4 0.0025 6.5 0.9194742 0.2730091
5 0.0025 8.5 0.9198104 0.2733598
6 0.0025 10.5 0.9204425 0.2787055
7 0.0025 12.5 0.9210958 0.2811878
8 0.0025 14.5 0.9217887 0.2869429
9 0.0025 16.5 0.9224985 0.2897108
10 0.0025 18.5 0.9222014 0.2837258
11 0.0050 0.5 0.9154192 0.2231682
如何将其可视化为正方形网格或另一种合适的方式?