📅  最后修改于: 2022-03-11 14:57:28.499000             🧑  作者: Mango
library('caret')
fitControl <- trainControl(
method = 'LOOCV', # k-fold cross validation 'cv'
number = 1, # number of folds
savePredictions = 'final', # saves predictions for optimal tuning parameter
classProbs = T , # should class probabilities be returned
summaryFunction=twoClassSummary # results summary function
)
train(Species ~ Sepal.Length, data=irisData ,method='rf', tuneGrid=data.frame(mtry=1) ,trControl = fitControl)