How to use append function in treebagger?
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Ilya
2012-7-30
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
2012-7-30
编辑:Ilya
2012-7-30
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 个评论
Ilya
2012-7-31
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})
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Classification Ensembles 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!