Products & Services Solutions Academia Support User Community Company

Learn more about Statistics Toolbox   

children - Class: classregtree

Child nodes

Syntax

C = children(t)
C = children(t,nodes)

Description

C = children(t) returns an n-by-2 array C containing the numbers of the child nodes for each node in the tree t, where n is the number of nodes. Leaf nodes have child node 0.

C = children(t,nodes) takes a vector nodes of node numbers and returns the children for the specified nodes.

Examples

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 else node 3
2  class = setosa
3  if PW<1.75 then node 4 else node 5
4  if PL<4.95 then node 6 else node 7
5  class = virginica
6  if PW<1.65 then node 8 else node 9
7  class = virginica
8  class = versicolor
9  class = virginica

view(t)

C = children(t)
C =
     2     3
     0     0
     4     5
     6     7
     0     0
     8     9
     0     0
     0     0
     0     0

References

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

See Also

classregtree, numnodes, parent

  


Recommended Products

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