How to use append function in treebagger?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have two different trees which are made from different data of same variables. When i was trying to append the two trees to form one tree using append function it is showing the error.
My Code
Storm29= TreeBagger(70,x,y,'OOBPred','on','categorical',[1,2,6],'method','regression'); Strom18= TreeBagger(70,x1,y1,'OOBPred','on','categorical',[1,2,6],'method','regression'); Strom29 = append(Storm29,Strom18);
Error: Error using TreeBagger/append (line 782) The two objects have incompatible X data.
Note: The variables are used in the tree are same but different data
0 commentaires
Réponses (2)
Ilya
le 30 Juil 2012
TreeBagger/append is intended for combining two ensembles grown on the same data. If you have two different sets of data, the best way is to merge them and grow an ensemble on the merged set. If this is not possible for some reason, combine predictions from the two ensembles, that is, compute an overall prediction using the predicted scores from ensemble 1 and the predicted scores from ensemble 2. The simplest recipe is to take an average. There are other, more involved recipes, of course.
Ilya
le 30 Juil 2012
Modifié(e) : Ilya
le 30 Juil 2012
You are asking for an online-learning algorithm, that is, one capable of incremental updates. This is a subject for research. I saw online versions of decision tree algorithms and online versions of various ensemble algorithms. You can google for those or I can send you some references if you are up to coding them yourself. Stats Tlbx does not provide them.
You can cheat by compact-ing the two TreeBagger objects and then executing combine method on the compact objects. That way the data checks will be skipped. Do it at your own risk. I do not know what the statistical properties of such combining would be and if there is any literature to support it.
2 commentaires
Ilya
le 31 Juil 2012
Please do not ask a new unrelated question in the same thread. Start a new one.
If you found my answer useful, please accept it.
If B is a TreeBagger object, type
B.Trees{1}
or
view(B.Trees{1})
Voir également
Catégories
En savoir plus sur Classification Ensembles 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!