How to get every tree's prediction value after using "TreeBagger" function
2 ビュー (過去 30 日間)
古いコメントを表示
Hi guys.
I trained bagging trees using TreeBagger function and set 200 for number of trees.
As I know, TreeBagger's prediction is mean value of 200 trees prediction value.
This is my question. Can I get every 200 tree's prediction value? before TreeBagger determined prediction value.
I need 200 tree's prediction value to ananlye my study but I can't find a way to do it. :(
I would greatly appreciate it if anyone tells me how to solve this problem.
Have a nice day :)
0 件のコメント
回答 (1 件)
TED MOSBY
2024 年 4 月 4 日
Hi Hyeon,
To individually get every tree’s prediction value you can use the ‘oobPredict’ method.
The ‘oobPredict’ method allows you to obtain the out-of-bag predictions made by each tree in the ensemble.
% ………..your code……….
yourModel = TreeBagger(numTrees, X, Y, ….)
% use one of the following two syntaxes depending on whichever works to get oob predictions for each tree
oobPredictions = oobPredict(yourmodel) or oobPredictions = yourmodel.oobPredict()
% …………your remaining code…………..
In the “oobPredictions” variable, you will have a matrix where each row corresponds to an observation in your dataset, and each column corresponds to the prediction made by a specific tree in the ensemble.
Alternatively, you can check out the following method as well in which you can turn the status for ‘OOBPrediction” attribute in the TreeBagger model as “on”:
Feel free to check out the following links for the “oobPredict” function to get more understanding for the same:
0 件のコメント
参考
カテゴリ
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!