Effacer les filtres
Effacer les filtres

How many levels of the tree should I prune in my decision tree?

5 vues (au cours des 30 derniers jours)
Radoslav Vandzura
Radoslav Vandzura le 20 Fév 2016
Modifié(e) : MHN le 20 Fév 2016
How many levels of the tree should I prune in my decision tree? How can I detect how many levels is appropriate to have?

Réponses (1)

MHN
MHN le 20 Fév 2016
Modifié(e) : MHN le 20 Fév 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.
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.

Catégories

En savoir plus sur Statistics and Machine Learning Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by