Remove or replace trees from a TreeBagger ensemble
Mostrar comentarios más antiguos
Hello,
There is this method TreeBagger.combine that can combine two independently trained TreeBagger classifiers.
The problem is that I have to combine two ensembles, but I want to replace randomly 25% of the trees from the first ensemble with trees from the second ensemble.
Three possible solutions to overcome my problem:
1. Method to remove specified trees from ensemble. Then I would just remove 25% of the ensemble with random indexes and combine with the second ensemble.
2. Method to construct new TreeBagger from a collection of trees. For example something like this:
TreeBagger=Construct(Tree1, Tree2, ...);
3. Method to replace trees in TreeBagger ensemble. For example I tried to do this, like in a structure:
ensemble.Trees{i}=new_tree;
but that didn't work, because the property is private.
Please help me, because I had no progress with any of three...
Respuesta aceptada
Más respuestas (1)
Artik Crazy
el 10 de Mzo. de 2012
2 comentarios
Ilya
el 10 de Mzo. de 2012
Various properties of your PrunedEnsemble are now broken. For example, OOBIndices are the indices of observations that are out-of-bag for the grown trees. Tree 101 in OriginalEnsemble must use column 101 of OOBIndices. In PrunedEnsemble, this tree has index 1 and will use column 1 of OOBIndices instead. Because the tree list and OOBIndices no longer match, you cannot use oobPredict anymore. This is just one example; there are other broken properties.
If you must go down this road, I would recommend modifying CompactTreeBagger in a similar fashion. You should then execute COMPACT on a TreeBagger object before removing trees. The compact class is simpler, and there is less chance you will screw something up by these changes. Certainly, the PREDICT method will work fine, but I cannot vouch for everything else.
Artik Crazy
el 10 de Mzo. de 2012
Categorías
Más información sobre Classification Ensembles en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!