1

我已经从https://gist.github.com/zachmayer/5152157尝试了 zachmayer 的代码,但是在运行 caretEnsemble 命令时出现错误“is(all.models, "caretList") is not TRUE"。我应该使用 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`
4

1 回答 1

1

您可以使用通用功能c()

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

PS 另外在fitControl()你必须设置savePredictions = TRUE

于 2016-10-04T18:38:28.000 回答