How many levels of the tree should I prune in my decision tree?
3 次查看(过去 30 天)
显示 更早的评论
How many levels of the tree should I prune in my decision tree? How can I detect how many levels is appropriate to have?
0 个评论
回答(1 个)
MHN
2016-2-20
编辑:MHN
2016-2-20
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.
load ionosphere
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);
end
plot(max(tree.PruneList):-1:1,er)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Electromechanical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!