Learn R Programming

RFmarkerDetector (version 1.0.1)

tuneNTREE: Tuning of the ntree parameter (i.e. the number of trees) for a Random Forest model

Description

This function tries to find the 'optimal' value for the parameter ntree which indicates the number of trees used to grow the ensemble of trees. To do that it will build several random forest models with a different number of trees for the mtry value considered. The number of models built for each ntree value will be equal to the parameter iteration. The oob errors of each random forest model, computed for each ntree value will be arranged in a matrix.

Usage

tuneNTREE(data, mtry, iterations, minNTREE = 500, pace = 100, seq_length = 5)

Arguments

data
the n x p dataframe used to build the Random Forest models. The first two columns must represent respectively the sample names and the class labels associated to each sample
mtry
the chosen mtry value
iterations
the number of Random Forest models to be built for each value of ntree
minNTREE
the minimum number of trees of each random forest model.
pace
the pace between each value of ntree to be tested
seq_length
the number of ntree values to be tested

Value

a n x p matrix in which n is the number of models considered and p is the number of ntree values tested. Each column represents the oob errors resulting from each model and corresponding to the different ntree values

Examples

Run this code
## data(cachexiaData)
## res <- tuneNTREE(cachexiaData, 8, iterations = 50, minNTREE = 600, pace = 100, seq_length = 10)

Run the code above in your browser using DataLab