How to show Sample Size at Each Split in Tree using fitctree?

2 ビュー (過去 30 日間)
Justin
Justin 2014 年 10 月 29 日
コメント済み: Justin 2014 年 10 月 31 日
Am using fitctree, and of course, altering the MinLeaf size changes the tree output drastically, but also interested in seeing how the sample size shrinks as the tree progresses.
Know how?
thanks! Justin

回答 (1 件)

Siddharth Sundar
Siddharth Sundar 2014 年 10 月 31 日
If I understand correctly, you want to be able to extract the subset of observations used at each split in a node.
The CutPredictor property ClassificationTree object is what you need.
tree.CutPredictor returns the names of the variables used in each node. You can use this along with the output of the CutPoint property (gives you the values used as cut points in the tree) to generate the subset of observations by using the conditions obtained from the above properties to index into the training data set.
  1 件のコメント
Justin
Justin 2014 年 10 月 31 日
My clarity could have been better - What I am seeking is to know the number of observations at each node in the tree.
That is, say we started with a sample size of 1000 observations. It would be of interest to me know if the first node split that into 500 / 500 or 900 / 100; and so on for each node in the tree.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeClassification Trees についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by