How many levels of the tree should I prune in my decision tree?
9 views (last 30 days)
MHN on 20 Feb 2016
Edited: MHN on 20 Feb 2016
There is no certain number for that. One way is computing resubstitution error for different pruning level and find the place which adding nodes does not significantly increase your accuracy.
tree = fitctree(X,Y);
er = zeros(max(tree.PruneList),1);
for i = 1:max(tree.PruneList)
ptree = prune(tree,'level',i);
er(i,1) = resubLoss(ptree);
for example in the above example, level four is a good choice. There are many methods to find the good pruning (before making the tree or after that), which depends on many factors.