BSkyMultiRandomForest: Optimal number of trees

View source: R/BSkyRandomForest.r

BSkyMultiRandomForestR Documentation

Optimal number of trees

Description

Starting with the default value of mtry, search for the optimal value (with respect to Out-of-Bag error estimate) of ntree (no of trees to grow) for randomForest. The function BSkyMultiRandomForest calls the function randomForest with the arguments defined below

Usage

BSkyMultiRandomForest(x, y = NULL, startval, endval, stepval, mtry)

Arguments

x

a data frame or a matrix of predictors, or a formula describing the model to be fitted (for the print method, an randomForest object).

y

A response vector. If a factor, classification is assumed, otherwise regression is assumed. If omitted, randomForest will run in unsupervised mode.

startval

starting value for ntree argument in randomForest().

endval

ending value for ntree argument in randomForest().

stepval

count by which startval should be incremented in every iteration till it reaches endval value.

mtry

Number of variables randomly sampled as candidates at each split. Note that the default values are different for classification (sqrt(p) where p is number of variables in x) and regression (p/3)

Value

Prints the optimal number of trees. Also displays a table with ntree and the corresponding Out-of-Bag error


BlueSkyStatistics/BlueSky documentation built on Jan. 29, 2025, 4:15 p.m.