oblique.tree.prune.nodes: Internal Function that Prunes Oblique Tree Objects

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Prunes entire subtrees off objects of class c("oblique.tree","tree").

Usage

1
2
3
oblique.tree.prune.nodes(
	tree, 
	list.of.node.names.to.prune)

Arguments

tree

Fitted model object of class oblique.tree. This is assumed to be the result of some function that produces an object with the same named components as that returned by oblique.tree.

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.

Details

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.

Value

An object of class c("oblique.tree","tree") is return.

Author(s)

A. Truong

See Also

oblique.tree.

Examples

 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")

oblique.tree documentation built on April 15, 2017, 4:38 a.m.