How to resolve error while ensembling Randomforest and Logistic regression using CaretEnsemble package?

r
ensemble

#1

Hi everyone,

I was working on a dataset, where logistic regression was performing better than randomforest. However, I decided to create an ensemble of both the models since the correlation between the predictions was quite low. I am working in R and hence googled out to find caretEnsemble package for ensembling the 2 models.
The following code was written by me:

library(caretEnsemble)
control <- trainControl(method="repeatedcv", number=10, repeats=3, savePredictions=TRUE, classProbs=TRUE)
algorithmList <- c('rf', 'glm')
set.seed(9)
models <- caretList(target~., data=train_pca, trControl=control, methodList=algorithmList)

However, the following error occurred :

Something is wrong; all the RMSE metric values are missing:
RMSE Rsquared
Min. : NA Min. : NA
1st Qu.: NA 1st Qu.: NA
Median : NA Median : NA
Mean :NaN Mean :NaN
3rd Qu.: NA 3rd Qu.: NA
Max. : NA Max. : NA
NA’s :3 NA’s :3
Error in train.default(x, y, weights = w, …) : Stopping
In addition: There were 50 or more warnings (use warnings() to see the first 50)

Could you please help me fix this error.

Thanks in advance!