processTree: Converts a tree to a graph

Description Usage Arguments Details Value Examples

Description

Processes and converts a single tree of a random forest to an igraph graph.

Usage

1
2
processTree(treeGraphList, rawTreeDataFrame, defaultColor = "blue",
  defaultShape = "square", classes = NULL, colors = NULL, shapes = NULL)

Arguments

treeGraphList

A list which contains the graphs.

rawTreeDataFrame

A tree, which created with the randomForest::getTree function.

defaultColor

The default color of the nodes.

defaultShape

The deafult shape of the nodes.

classes

The classes of the random forest target variables (if any).

colors

The colors of the classes (if any).

shapes

The shapes of the classes (if any).

Details

With this function you can convert a tree of a random forest model to an igraph graph. At first we process the raw tree data and make a graph data from it. After that we add properties to the graph. And finally we append the new graph to a list which contains igraph graphs.

Value

A list which contains the new and a previous graphs.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
# Model must be a valid rf model with keep.forest=TRUE
treeGraphList <- list()
treeGraphList <- processTree(
                   treeGraphList
                   randomForest::getTree(model, k=1, labelVar=TRUE),
                 )
print(treeGraphList)

## End(Not run)

burjandedes/randomForestDrawer documentation built on May 18, 2019, 9:16 p.m.