Borrar filtros
Borrar filtros

Number of leaf nodes used by regression tree

5 visualizaciones (últimos 30 días)
Maaz Ahmad
Maaz Ahmad el 3 de Abr. de 2021
Respondida: Aditya Patil el 7 de Abr. de 2021
Is there any way to know the exact number of leaf nodes in a trained regression tree (fitrtree) or each tree of a regression tree ensemble (fitrensemble)? Understand that hyperparameter optimization allows one to view the MaxNumSplits which give an idea of maximum branch nodes, and hence max number of leaf nodes (which should be MaxNumSplits+1, considering root node being a leaf node, for 0 split). However, the optimal number of branchings used in the trained model may be less than MaxNumSplits. How can we obtain this information from a trained regression tree model?

Respuestas (1)

Aditya Patil
Aditya Patil el 7 de Abr. de 2021
The IsBranchNode Property of RegressionTree is false for leaf nodes. So you can use it as follows,
X = rand(100, 4);
y = rand(100, 1);
mdl = fitrtree(X,y);
leaves = sum(~mdl.IsBranchNode);

Categorías

Más información sobre Classification en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by