caretEnsemble失败的是(all.models," caretList")不是TRUE

时间:2015-03-03 15:29:15

标签: r r-caret ensemble-learning

我已经尝试过来自https://gist.github.com/zachmayer/5152157的zachmayer代码,但我收到错误"是(all.models," caretList")不是TRUE" ,运行caretEnsemble命令时。我应该使用caretList而不是只列出所有模型吗?感谢。

`#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`

1 个答案:

答案 0 :(得分:1)

您可以使用常规功能c()

供参考:https://rdrr.io/cran/caretEnsemble/man/c.caretList.html

P.S。同样在fitControl()中,您必须设置savePredictions = TRUE