lisa  ling
lisa ling

Reputation: 11

caretEnsemble failing with is(all.models, "caretList") is not TRUE

I've tried the code of zachmayer from https://gist.github.com/zachmayer/5152157, but I got an error "is(all.models, "caretList") is not TRUE", when running caretEnsemble command. Should I use caretList instead of just making a list of all the models? Thanks.

`#Train some models  
model1 <- train(X[train,], Y[train], method='gbm', trControl=myControl,
            tuneGrid=expand.grid(.n.trees=500, .interaction.depth=15,.shrinkage = 0.01))
model2 <- train(X[train,], Y[train], method='blackboost', trControl=myControl)
...
#Make a list of all the models  
all.models <- list(model1, model2, model3, model4, model5, model6, model7, model8, model9, model10)

#Make a greedy ensemble
 greedy <- caretEnsemble(all.models, iter=1000L)
Error: is(all.models, "caretList") is not TRUE`

Upvotes: 1

Views: 968

Answers (1)

Vadym B.
Vadym B.

Reputation: 681

You can use general functionc()

For reference : https://rdrr.io/cran/caretEnsemble/man/c.caretList.html

P.S. Also in fitControl() you have to set savePredictions = TRUE

Upvotes: 1

Related Questions