Statistics Toolbox    
treedisp

Show classification or regression tree graphically

Syntax

Description

treedisp(T) takes as input a decision tree T as computed by the treefit function, and displays it in a figure window. Each branch in the tree is labeled with its decision rule, and each terminal node is labeled with the predicted value for that node.

For each branch node, the left child node corresponds to the points that satisfy the condition, and the right child node corresponds to the points that do not satisfy the condition.

The Click to display pop-up menu at the top of the figure enables you to display more information about each node:

Identity
The node number, whether the node is a branch or a leaf, and the rule that governs the node
Variable ranges
The range of each of the predictor variables for that node
Node statistics
The number of elements of the data set that fit the node and ... (the mean and standard deviation of what?)

After you select the type of information you want, click on any node to display the information for that node.

The Pruning level spin button displays the number of levels that have been cut from the tree, and the number of levels in the unpruned tree. For example, 1 of 6 indicates that the unpruned tree has six levels, and that one level has been cut from the tree. Use the spin button to change the pruning level.

treedisp(T,'param1',val1,'param2',val2,...) specifies optional parameter name-value pairs. Valid parameters are:

'names'
A cell array of names for the predictor variables, in the order in which they appear in the X matrix from which the tree was created (see treefit)
'prunelevel'
Initial pruning level to display

Examples

Create and graph classification tree for Fisher's iris data. The names in this example are abbreviations for the column contents (sepal length, sepal width, petal length, and petal width).

See Also

treefit, treeprune, treetest


  tpdf treefit