Description Usage Arguments Value Author(s) See Also Examples
Creates a plot of a rktree
that was built from the (training) dataset.
The package igraph
is loaded internally when this function is called,
to aid in generating the plot of a rktree
.
DESCRIPTIONS OF THE rktree
PLOT:
The resulting plot is a classical decision tree.
The rectangular nodes (or vertices) that contain "=<" symbol are used to
describe the splitting criteria applied to that very node while constructing
the rktree
; for example, in the rktree
plot generated by the code
shown in the "examples" section below, the node with the label
"Petal.Width =< 1.6" indicates that this node was split into a chunk that
contains observations with Petal.Width <= 1.6 and a chunk that contains
observations with Petal.Width greater than 1.6, in order to construct the
rktree
.
Any other rectangular nodes (or vertices) that do not contain the "=<" symbol
indicate that we have reached an end node, and the text displayed in such node
is the actual name of the class type that the rktree model assigns to the
observations belonging to that node; for example, in the rktree
plot
generated by the code shown in the "examples" section below, the vertex with
the label "setosa" indicates that the rktree
assigns the class type
"setosa" to all observations that belong to that particular node.
1 2 3 4 | draw.treeRK(tr = construct.treeRK(), y.factor.levels,
font = "Times", node.colour = "white", text.colour = "dark blue",
text.size = 0.67, tree.vertex.size = 75, tree.title = "Diagram of a Tree",
title.colour = "dark blue")
|
tr |
a |
y.factor.levels |
a |
font |
font type used in the |
node.colour |
colour of the node used in the |
text.colour |
colour of the text used in the |
text.size |
size of the text in the |
tree.vertex.size |
size of the |
tree.title |
title of the |
title.colour |
colour for the title of the |
An igraph
plot of a rktree
.
Hyunjin Cho, h56cho@uwaterloo.ca Rebecca Su, y57su@uwaterloo.ca
mds.plot.forestRK
importance.plot.forestRK
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## example: iris dataset
## load the forestRK package
library(forestRK)
## Numericize the data
x.train <- x.organizer(iris[,1:4], encoding = "num")[c(1:25,51:75,101:125),]
y.train <- y.organizer(iris[c(1:25,51:75,101:125),5])$y.new
y.factor.levels <- y.organizer(iris[c(1:25,51:75,101:125),5])$y.factor.levels
## Construct a tree
# min.num.obs.end.node.tree is set to 5 by default;
# entropy is set to TRUE by default
tree.entropy <- construct.treeRK(x.train, y.train)
# Plot the tree
draw.treeRK(tree.entropy, y.factor.levels, font="Times",
node.colour = "black", text.colour = "white", text.size = 0.7,
tree.vertex.size = 100, tree.title = "Decision Tree",
title.colour = "dark green")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.