RF2Selectedtrees {ForestDisc} | R Documentation |
Internal function: Trees extraction from Random Forest
Description
Learn decision splits from random forest algorithm. The resulting model consists of a set of trees where each tree is a collection of rules, and each rule is a combination of decision splits (pairs of variable/value(s)) defined from a root node to a terminal node.
Usage
RF2Selectedtrees (X,Y,ntree,max_TreeRules = 'default',min_RuleSupport = 'default')
Arguments
X |
Descriptive attributes data frame. |
Y |
Target attribute (A response vector). |
ntree |
Number of trees to grow using Random Forest algorithm. |
max_TreeRules |
The maximum number of rules in each tree. It represents the maximum number of terminal nodes in each tree grown by random forest. The default value is the one set in random forest algorithm. |
min_RuleSupport |
The minimum support related to each rule (defined from a root node to a leef node). The support of a rule represents the size of its terminal node divided by the number of instances in the data. The default value used is the minimum size of terminal node set in random forest algorithm divided by the number of instances in the data. |
Value
List with components:
ntree |
Number of trees. |
list |
List of 'ntree' matrix where each one corresponds to a tree grown by random forest algorithm. Each matrix consists of six columns and number of rows equal to the number of nodes in the tree. (more details can be found in the documentation of the function 'getTree' from “randomForest” package) |
RF |
The original call to randomForest algorithm used. |
xlevels |
vector of lists of size equal to the number of predictors. Each list corresponds to an attribute. In the case of categorical attribute, the categories are returned. In the case of continuous attribute, the distinct splits values performed by random Forest are returned. |
continuous_var |
Vector of continuous predictors. |
categorical_var |
Vector of categorical predictors. |
Author(s)
Haddouchi Maïssae
Examples
data(iris)
Mydata=iris
id_target=5
set.seed(1234)
X=Mydata[,1:(id_target-1)]
Y=Mydata[,id_target]
ntree=50
RFTREES=RF2Selectedtrees(X,Y,ntree)