Description Usage Arguments Details Value Examples
Processes and converts a single tree of a random forest to an igraph graph.
1 2 | processTree(treeGraphList, rawTreeDataFrame, defaultColor = "blue",
defaultShape = "square", classes = NULL, colors = NULL, shapes = NULL)
|
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). |
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.
A list which contains the new and a previous graphs.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.