| Statistics Toolbox™ | ![]() |
C = cutcategories(t)
C = cutcategories(t,nodes)
C = cutcategories(t) returns an n-by-2 cell array C of the categories used at branches in the decision tree t, where n is the number of nodes. For each branch node i based on a categorical predictor variable x, the left child is chosen if x is among the categories listed in C{i,1}, and the right child is chosen if x is among those listed in C{i,2}. Both columns of C are empty for branch nodes based on continuous predictors and for leaf nodes.
C = cutcategories(t,nodes) takes a vector nodes of node numbers and returns the categories for the specified nodes.
Create a classification tree for car data:
load carsmall
t = classregtree([MPG Cylinders],Origin,...
'names',{'MPG' 'Cyl'},'cat',2)
t =
Decision tree for classification
1 if Cyl=4 then node 2 else node 3
2 if MPG<31.5 then node 4 else node 5
3 if Cyl=6 then node 6 else node 7
4 if MPG<21.5 then node 8 else node 9
5 if MPG<41 then node 10 else node 11
6 if MPG<17 then node 12 else node 13
7 class = USA
8 class = France
9 class = USA
10 class = Japan
11 class = Germany
12 class = Germany
13 class = USA
view(t)

C = cutcategories(t)
C =
[4] [1x2 double]
[] []
[6] [ 8]
[] []
[] []
[] []
[] []
[] []
[] []
[] []
[] []
[] []
[] []
C{1,2}
ans =
6 8[1] Breiman, L., et al., Classification and Regression Trees, Chapman & Hall, Boca Raton, 1993.
classregtree, cutvar, cutpoint, cuttype
![]() | crossval | cutpoint | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |