How to get the prediction result of each decision tree in random forest?

조회 수: 4 (최근 30일)
hanwen
hanwen 2023년 8월 29일
답변: Ramtej 2023년 8월 31일
First I built a random forest regression model
RFModel6=TreeBagger(nTree,TrainVARI,TrainYield,...
'Method','regression','OOBPredictorImportance','on', 'MinLeafSize',nLeaf);
Then how can I get the predicted value of each decision tree?

답변 (1개)

Ramtej
Ramtej 2023년 8월 31일
Hi hanwen,
I understand that you are trying to predict value of each decision tree from the ensemble of bagged decision trees.
You can access an individual tree by using the "Trees" property of "TreeBagger" class and predict using each individual tree.
% Example
total_trees = RFModel6.Trees % cell array of trees
predicted_data = cell(nTree, 1) % dummy output cell array
for tree=1:nTree
predicted_data{tree} = predict(total_trees{tree}, X_input);
end
Hope this helps!

카테고리

Help CenterFile Exchange에서 Classification Ensembles에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by