Mirrors the C# RandomForest class: fits number_of_trees decision trees on bootstrap
resamples of the training data and reports the spread of their predictions as an interval.
Usage
ml_random_forest(
x,
y,
newdata,
seed = NULL,
regression = TRUE,
features = NULL,
minimum_split_size = 2,
max_depth = 100,
number_of_trees = 1000,
alpha = 0.1
)Arguments
- x
a numeric matrix or data frame of training predictors, one row per observation.
- y
the training response, one value per row of
x.- newdata
predictors to predict for, with the same number of columns as
x.- seed
integer PRNG seed;
NULLuses the computer clock.- regression
TRUE(the default) fits regression trees;FALSEclassifiers.- features
the number of random features per split.
NULLusesmax(1, ncol(x) - 1).- minimum_split_size
the smallest node a tree will split. Default 2.
- max_depth
the recursion cap. Default 100.
- number_of_trees
how many trees to grow. Default 1000.
- alpha
the interval level: 0.1 (the default) gives a 90% interval.
Details
Training cost is linear in number_of_trees, and the library's default of 1000 is the knob to
turn if a call is slow – a few dozen trees is usually enough to see the shape of the answer.
A seeded run is bit-identical between R and Python, because the whole computation lives in the
shared compiled core.
For a classifier every column is floored to an integer class label, including mean.