Description Usage Arguments Details Value Author(s) See Also Examples
Prunes entire subtrees off objects of class c("oblique.tree","tree").
1 2 3 | oblique.tree.prune.nodes(
tree,
list.of.node.names.to.prune)
|
tree |
Fitted model object of class |
list.of.node.names.to.prune |
A list containing subtrees that are to be pruned. Each subtree is represented by a vector of its node names starting from its root to its the last node. |
The data structure representing objects of class c("oblique.tree","tree") need to be carefully manipulated to reflect the pruning of nodes. Rows of tree$frame are removed and tree$frame$var, tree$frame$splits, tree$where, tree$y tree$details need to be updated.
An object of class c("oblique.tree","tree") is return.
A. Truong
1 2 3 4 5 6 7 8 9 10 11 12 13 | #grow a tree on the Pima Indian dataset
data(Pima.tr, package = "MASS")
ob.tree <- oblique.tree(formula = type~.,
data = Pima.tr,
oblique.splits = "on")
plot(ob.tree);title(main="Oblique Tree")
#prune 1 subtree
plot( oblique.tree:::oblique.tree.prune.nodes(
tree = ob.tree,
list.of.node.names.to.prune = list(c(5,10,11,22,23,46,47,94,95))
)
);title(main="Prune one Subtree")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.