Documentation Center

  • Trial Software
  • Product Updates


Class: classregtree




view(t) displays the decision tree t as computed by classregtree 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. Click any node to get more information about it. The information displayed is specified by the Click to display pop-up menu at the top of the figure.

view(t,param1,val1,param2,val2,...) specifies optional parameter name/value pairs:

  • 'names' — A cell array of names for the predictor variables, in the order in which they appear in the matrix X from which the tree was created. (See classregtree.)

  • 'prunelevel' — Initial pruning level to display.

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.


Create a classification tree for Fisher's iris data:

load fisheriris;

t = classregtree(meas,species,...
                 'names',{'SL' 'SW' 'PL' 'PW'})
t = 
Decision tree for classification
1  if PL<2.45 then node 2 elseif PL>=2.45 then node 3 else setosa
2  class = setosa
3  if PW<1.75 then node 4 elseif PW>=1.75 then node 5 else versicolor
4  if PL<4.95 then node 6 elseif PL>=4.95 then node 7 else versicolor
5  class = virginica
6  if PW<1.65 then node 8 elseif PW>=1.65 then node 9 else versicolor
7  class = virginica
8  class = versicolor
9  class = virginica



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

See Also

| | |

Was this topic helpful?