Statistics Toolbox    
treeprune

Produce a sequence of subtrees by pruning

Syntax

Description

T2 = treeprune(T1,'level',level) takes a decision tree T1 as created by the treefit function, and a pruning level level, and returns the decision tree T2 pruned to that level. The value level = 0 means no pruning. Trees are pruned based on an optimal pruning scheme that first prunes branches giving less improvement in error cost.

T2 = treeprune(T1,'nodes',nodes) prunes the nodes listed in the nodes vector from the tree. Any T1 branch nodes listed in nodes become leaf nodes in T2, unless their parent nodes are also pruned. The treedisp function can display the node numbers for any node you select.

T2 = treeprune(T1) returns the decision tree T2 that is the same as T1, but with the optimal pruning information added. This is useful only if you created T1 by pruning another tree, or by using the treefit function with pruning set 'off'. If you plan to prune a tree multiple times, it is more efficient to create the optimal pruning sequence first.

Pruning is the process of reducing a tree by turning some branch nodes into leaf nodes, and removing the leaf nodes under the original branch.

Examples

Display the full tree for Fisher's iris data, as well as the next largest tree from the optimal pruning sequence.

See Also

treefit, treetest, treedisp


  treefit treetest