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

回答(2 个)

Ilya
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.
  1 个评论
vijay sabawat
vijay sabawat 2012-7-30
Thank You!!!
My objective is to keep updating tree based on the newly available data sets. Is there anyway to do this except for running the tree model with all the data set each and every time (My data set is huge so it is difficult for me to store the data and append it with new data and to run treebagger all again).

请先登录,再进行评论。


Ilya
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 个评论
vijay sabawat
vijay sabawat 2012-7-31
Hi, Is there a way to plot the tree of a treebagger. I know that the treebagger is made of many trees but i am curious to know how exactly the split is occurring in tree.
Ilya
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 CenterFile Exchange 中查找有关 Classification Ensembles 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by