Description Usage Arguments Value Author(s) See Also Examples
View source: R/ends.index.finder.R
Identifies numerical indices of the end nodes of a rktree
by
closely examining the structure of the rktree
flag (obtained via
construct.treeRK()$flag
); the precise algorithm used is the following:
if m-th string in the list of rktree
flag is a substring of one or
more of (m + 1),...,n-th strings in the list of flag, then the node
represented by the m-th string of the flag is not an end node; otherwise,
the node represented by the m-th string of the flag is the end node.
1 | ends.index.finder(tr.flag = matrix())
|
tr.flag |
a |
A vector that lists the indices of the end nodes of a given rktree
(indices that are consistent to the indices in x.node.list
,
y.new.node.list
, and flag
that are returned by the
construct.treeRK
function).
Hyunjin Cho, h56cho@uwaterloo.ca Rebecca Su, y57su@uwaterloo.ca
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## example: iris dataset
## load the forestRK package
library(forestRK)
# covariates of training data set
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
# 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)
# Find indices of end nodes of tree.entropy
end.node.index <- ends.index.finder(tree.entropy$flag)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.