Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you reduce the default ntree=500 parameter passed to RF from caret?

I believe the "rf" (randomForest) method in caret sets the default number of trees at 500. Unfortunately, this causes the time complexity to grow out of control for larger datasets. Is there any quick way to reduce the number of trees without creating a custom method? I know that the only tuneable parameter for rf is mtry.

Just to clarify: I'm not looking to tune on number of trees. I simply want to fix it to a lower value so that I can run rf in a reasonable amount of time.

like image 304
Ben Rollert Avatar asked Jul 07 '15 20:07

Ben Rollert


1 Answers

You can specify the ntree parameter when you call train like so:

rf <- train(X, y, method="rf", preProcess=c("center","scale"), ntree=100, trControl=fitControl)
like image 149
HasaniH Avatar answered Oct 21 '22 18:10

HasaniH