get regions from treebagger
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Afshin OroojlooyJadid
el 12 de Sept. de 2017
Comentada: Afshin OroojlooyJadid
el 18 de Sept. de 2017
Hi,
I have a random forest, trained through treeBagger function. I need to check for the new point x, whether it results in a same region R_t for all t, with historical point x_j, for all j. Please let me know me how I can get it.
Best, Afshin
2 comentarios
Sarah Mohamed
el 15 de Sept. de 2017
Please provide more clarity regarding your question. Is this a classification or regression problem? What do "t" and "j" signify? Are you trying to predict whether a new point has the same response for all values of a certain predictor?
Respuesta aceptada
Sarah Mohamed
el 18 de Sept. de 2017
Thanks for the clarification!
Let me assume that you've trained an ensemble of trees using the TreeBagger function, and that this bag of trees is called 'B'.
A cell vector of the trained CompactRegressionTree subtrees is stored in the ‘Trees’ property of B. Assuming that you’ve extracted one of these trees, ‘tree1’, as follows,
tree1 = B.Trees{1};
You can determine the leaf node that determines the predicted output for the observation (or array of observations) X, using the 'predict' function:
[~,node] = predict(tree1,X)
If you would like the parent of the leaf node (e.g, the node that ‘splits’ the data), you can look up the node’s parent in the ‘Parent’ property of ‘tree1’:
splittingNode = tree1.Parent(node);
Más respuestas (0)
Ver también
Categorías
Más información sobre Classification Ensembles en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!