getLevelsOfSplitVariablesForest: returns the number of different categories

Description Usage Arguments Value See Also Examples

Description

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.

Usage

1
getLevelsOfSplitVariablesForest(cF, splitVariablesForest)

Arguments

cF

A CategoryFrequenciesForest-object as it is returned by getCategoryFrequenciesForest

splitVariablesForest

A list containing the indices of the variables used for splitting in the forest as they are returned by getSplitVariablesForest or getSplitInformationForest.

Value

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.

See Also

getSplitVariablesForest

Examples

 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

adibender/rFtools documentation built on May 14, 2019, 5:13 a.m.