Description Usage Arguments Value Note See Also Examples
For each (not terminal) node of a tree this function retrieves the path from the according node to the root of the considered tree.
1 | getAncestryTree(tree = matrix())
|
tree |
A |
A list
of the same length as number of not terminal nodes in the tree.
Each element contains the path from the according node to the root of the tree,
by providing the index of the variables used for splitting. First value
is the closest ancestor, last value equals the root.
For reasons of efficiency this function does not apply
getAncestryNode
. Therefore the result for a specific node
differs slightly regarding the layout, e.g. node indices are omitted.
getAncestryNode
, getAncestryForest
1 2 3 4 5 6 7 8 9 10 | ## data
YX <- simulateSNPdata(seed = 123)
## forest
rF <- randomForest(x = YX[ , -1], y = YX[ , 1], keep.forest = TRUE,
keep.inbag = TRUE, importance = TRUE, ntree = 500)
## ancestry
getAncestryTree(getTree(rF, 1))[5:10]
getAncestryNode(10, getTree(rF,1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.