Description Usage Arguments Value See Also Examples
For every not terminal node, i.e. for every variable used for splitting in the forest, this function returns the number of different levels/categories the variable actually has in the according node.
1 | getLevelsOfSplitVariablesForest(cF, splitVariablesForest)
|
cF |
A |
splitVariablesForest |
A |
A list
of the same length as number of trees in the forest.
Each element contains a vector
of the same length as number of not terminal
nodes in the according tree. Returns the categoricality of the variables used
for splitting in the according node.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## data
YX <- simulateSNPdata(seed = 123)
## forest
rF <- randomForest(x = YX[ , -1], y = YX[ , 1], keep.forest = TRUE,
keep.inbag = TRUE, importance = TRUE, ntree = 500)
## category frequencies
cF <- getCategoryFrequenciesForest(rF, X = YX[ , -1])
## levels of split variables
splitVarsF <- getSplitVariablesForest(rF)
levelsF <- getLevelsOfSplitVariablesForest(cF, splitVarsF)
length(levelsF) == rF$ntree
levelsF[[1]] # levels for first tree
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.