How to count terminate leaves in decision tree?
2 ビュー (過去 30 日間)
古いコメントを表示
Hello All. I would like to ask you, exist any way how to count number of terminate leaves in decision tree? For example, I have two kinds of terminate leaves yes|no. I would like to know how many are yes and how many are no from all terminate leaves...Thank you in advance for your answer...
0 件のコメント
採用された回答
per isakson
2016 年 2 月 20 日
編集済み: per isakson
2016 年 2 月 21 日
"exist any way how to count number of terminate leaves in decision tree?"   This is what I found in the R2014a documentation
load ionosphere
my_tree = fitctree(X,Y);
sum(double(not(my_tree.IsBranch)))
which returned "19" for this example (copy&pasted from the documentation).
"how many are yes and how many are no from all terminate leaves"   after some browsing of the documentation
is_leaf = not(my_tree.IsBranch);
cac = my_tree.NodeClass(is_leaf);
n_g = sum(double(strcmp( cac, 'g' )));
n_b = sum(double(strcmp( cac, 'b' )));
[ n_g, n_b, n_g+n_b ]
outputs
ans =
6 13 19
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Analysis of Variance and Covariance についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!