| Statistics Toolbox™ | ![]() |
P = classprob(t)
P = classprob(t,nodes)
P = classprob(t) returns an n-by-m array P of class probabilities for the nodes in the classification tree t, where n is the number of nodes and m is the number of classes. For any node number i, the class probabilities P(i,:) are the estimated probabilities for each class for a point satisfying the conditions for node i.
P = classprob(t,nodes) takes a vector nodes of node numbers and returns the class probabilities for the specified nodes.
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)

P = classprob(t)
P =
0.3333 0.3333 0.3333
1.0000 0 0
0 0.5000 0.5000
0 0.9074 0.0926
0 0.0217 0.9783
0 0.9792 0.0208
0 0.3333 0.6667
0 1.0000 0
0 0 1.0000[1] Breiman, L., et al., Classification and Regression Trees, Chapman & Hall, Boca Raton, 1993.
![]() | classify | classregtree | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |