I'm a little confused how caret scores the test folds in k-fold cross validation.
I'd like to generate a data frame or matrix containing the scored records of the ten test datasets in 10-fold cross validation.
For example, using the iris dataset to train a decision tree model:
install.packages("caret", dependencies=TRUE)
library(caret)
data(iris)
train_control <- trainControl(method="cv", number=10, savePredictions = TRUE),
model <- train(Species ~ ., data=iris, trControl=train_control, method="rpart")
model$pred
The model$pred
command lists predictions for ten folds in 450 records.
This doesn't seem right - shouldn't model$pred
produce predictions for the 150 records in the ten test folds (1/10 * 150 = 15 records per test fold)? How are 450 records generated?