Displaying 2 results from an estimated 2 matches for "train_control".
2017 Oct 16
1
ROC curve for each fold in one plot
Hi all,
I have tried a 5 fold cross validation using caret package with random forest method on iris dataset as example. Then I need ROC curve for each fold:
> set.seed(1)
> train_control <- trainControl(method="cv", number=5,savePredictions = TRUE,classProbs = TRUE)
> output <- train(Species~., data=iris, trControl=train_control, method="rf")
> library(pROC)
> selectedIndices <- output$pred$Resample == "Fold1"
> plot.roc...
2017 Oct 22
0
Test set and Train set in Caret package train function
Hey all,
Does anyone know how we can get train set and test set for each fold of 5 fold cross validation in Caret package? Imagine if I want to do cross validation by random forest method, I do the following in Caret:
set.seed(12)
train_control <- trainControl(method="cv", number=5,savePredictions = TRUE)
rfmodel <- train(Species~., data=iris, trControl=train_control, method="rf")
first_holdout <- subset(rfmodel$pred, Resample == "Fold1")
str(first_holdout)
'data.frame': 90 obs. of 5 variabl...