设置R~Caret包中的树木数量

own*_*ner 2 tree r classification random-forest r-caret

我目前想知道使用Caret包中的随机森林算法设置10棵树的方法,并希望可以获得帮助:

下面是我的语法:

tr <- trainControl(method = "repeatedcv",number = 20)

fit<-train(y ~.,method="rf",data=example, trControl=tr)
Run Code Online (Sandbox Code Playgroud)

关于http://www.inside-r.org/packages/cran/randomForest/docs/randomForest的研究

在使用n=10randomForest()n.trees在使用情况下设置为参数gbm可能仅仅有帮助,但我对该Caret包感兴趣.

任何反馈都将非常感激.

谢谢

ale*_*emm 7

Caret 在您在通话中指定时train()使用该randomForest()功能.method = "rf"train

你只需要传递ntree = 10train然后将传递给randomForest().

因此,您的通话将如下所示:

fit <- train(y ~., method="rf",data=example, trControl=tr, ntree = 10)


Dou*_*Fir 5

对于在我的职位上使用随机森林游侠方法登陆这里的任何人的兴趣(在我的搜索词中指定“游侠”时,谷歌仍然指向我这里)使用 num.trees。

num.trees = 20
Run Code Online (Sandbox Code Playgroud)