| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Statistics Toolbox |
| Contents | Index |
| Learn more about Statistics Toolbox |
Note treedisp will be removed in a future release. Use classregtree.view instead. |
treedisp(t)
treedisp(t,param1,val1,param2,val2,...)
Note This function is superseded by the view method of the classregtree class and is maintained only for backwards compatibility. It accepts objects t created with the classregtree constructor. |
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, as described in the following table.
| Menu Choice | Displays |
|---|---|
| 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 | Descriptive statistics for the observations falling into this node |
After you select the type of information you want, click any node to display the information for that node.
The Pruning level 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, listed in the following table.
| Parameter | Value |
|---|---|
| '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 |
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).
load fisheriris;
t = treefit(meas,species);
treedisp(t,'names',{'SL' 'SW' 'PL' 'PW'});

[1] Breiman, L., J. Friedman, R. Olshen, and C. Stone. Classification and Regression Trees. Boca Raton, FL: CRC Press, 1984.
![]() | TreeBagger | treefit | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |