I was trying to run SVM model using 10-fold cross-validation with 3 repeats using the caret package in R. I want to get the prediction results of each fold using the best tuned hyperparameters. I am using the following code
# Load packages
library(mlbench)
library(caret)
# Load data
data(BostonHousing)
#Dividing the data into train and test set
set.seed(101)
sample <- createDataPartition(BostonHousing$medv, p=0.80, list = FALSE)
train <- BostonHousing[sample,]
test <- BostonHousing[-sample,]
control <- trainControl(method='repeatedcv', number=10, repeats=3, savePredictions=TRUE)
metric <- 'RMSE'
# Support Vector Machines (SVM)
set.seed(101)
fit.svm <- train(medv~., data=train, method='svmRadial', metric=metric,
preProc=c('center', 'scale'), trControl=control)
fit.svm$bestTune
fit.svm$pred
fit.svm$pred
giving me predictions using all combinations of the hyperparameters. But I want to have only the predictions using best-tuned hyperparameters for each 10-fold average of the repeats.