0
我正在嘗試使用包caret獲取各種培訓模型的預測統計信息。下面是說明我需要一個例子:使用插入符號預測多個模型的統計信息
library(caret)
# Training:
# ... Get X and Y for training a binary classification problem.
# ... X is input (2000, 5) Y is output (2000,1) ...
tmp <- createDataPartition(Y, p = 3/4, times = 3, list = TRUE, groups = min(5, length(Y)))
myCtrl <- trainControl(method = "boot", index = tmp, timingSamps = 2, classProbs = TRUE, summaryFunction = twoClassSummary)
RFmodel <- train(X,Y,method='rf',trControl=myCtrl,tuneLength=1, metric="ROC")
SVMmodel <- train(X,Y,method='svmRadial',trControl=myCtrl,tuneLength=3, metric="ROC")
KNNmodel <- train(X,Y,method='knn',trControl=myCtrl,tuneLength=10, metric="ROC")
NNmodel <- train(X,Y,method='nnet',trControl=myCtrl,tuneLength=3, trace = FALSE, metric="ROC")
# resamps reports ROC, Sens, Spec for all models
resamps <- resamples(list(RF = RFmodel, KNN = KNNmodel, NN = NNmodel, SVM = SVMmodel))
# Prediction:
# ... Collect X_pred (7000, 5) and Y_pred (7000,1) ...
testPred <- predict(list(RF = RFmodel, KNN = KNNmodel, NN = NNmodel, SVM = SVMmodel), Xtst, type="prob")
我怎樣才能得到的預測(ROC等)從X_kand Y_ pred
我的4款車型的統計數據?