Different results when using oobPredict for TreeBagger

15 views (last 30 days)
I've noticed that averaging the predicted OOB responses for individual trees using 'oobPredict(B, 'trees', i)' produces different results than when using oobPredict(B, 'trees', 'all'). Ex:
b = TreeBagger(no_trees,xtrain,ytrain,'method','r','OOBVarImp','off',... 'OOBPred','on','minleaf',1); yhat_oob_tree = zeros(no_trees,numel(ytrain)); for i = 1:no_trees % one row per tree yhat_oob_tree(i,:) = oobPredict(b,'trees',i); end avg_yhat_oob_tree = mean(yhat_oob_tree); %avg. by observations(columns) yhat_oob_all = oobPredict(b);
That is, 'avg_yhat_oob_tree' and 'yhat_oob_all' are different, doen anyone why this happens?
Thank you!

Answers (1)

Ilya
Ilya on 13 Aug 2012
See http://www.mathworks.com/matlabcentral/answers/9638-difference-between-individual-and-cumulative-oobmargin-of-treebagger It's the same problem here. When you ask for obbPredict from one tree, you get predictions filled with default values for in-bag observations.

Community Treasure Hunt

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

Start Hunting!