Class: CompactClassificationTree

View tree




view(tree) returns a text description of tree, a decision tree.

view(tree,Name,Value) describes tree with additional options specified by one or more Name,Value pair arguments.

Input Arguments


A classification tree or compact classification tree created by fitctree or compact.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.


String describing the display of tree, either 'graph' or 'text'. 'graph' opens a user interface displaying tree, and containing controls for querying the tree. 'text' sends output to the Command Window describing tree.

Default: 'text'


View the classification tree for Fisher's iris model in both textual and graphical displays:

load fisheriris
tree = fitctree(meas,species);

Decision tree for classification
1  if x3<2.45 then node 2 elseif x3>=2.45 then node 3 else setosa
2  class = setosa
3  if x4<1.75 then node 4 elseif x4>=1.75 then node 5 else versicolor
4  if x3<4.95 then node 6 elseif x3>=4.95 then node 7 else versicolor
5  class = virginica
6  if x4<1.65 then node 8 elseif x4>=1.65 then node 9 else versicolor
7  class = virginica
8  class = versicolor
9  class = virginica


Was this topic helpful?