View the tree ensemble trained by fitcensemble
조회 수: 10 (최근 30일)
이전 댓글 표시
Dear, let's suppose I'm training a bagged tree ensemble on the 40 sampe points (29 features per sample)
The GT labels are in the var labels.
I gat a tree mdlRF as follows:
dataSel = rand(40, 29); % just a toy example
labels = logical(randi(1,29,1)); % just a toy example
t = templateTree('PredictorSelection','interaction-curvature','Surrogate','on', ...
'Reproducible',true); % For reproducibility of random predictor selections
mdlRF = fitcensemble(dataSel,labels,'Method','Bag', ...
'CategoricalPredictors',[false true true true true true], 'PredictorNames', vars,...
'NumLearningCycles',30,'Learners',t);
If the trained learner were a simple tree I could have viewed it in graph /text mode with the command:
view(mdlRF, 'Mode', 'graph')
Is there an alternative way to view how the mdlRF makes the decision??
댓글 수: 0
답변 (1개)
Puru Kathuria
2020년 3월 6일
Hi,
I understand that you want to visualize your ensemble after training it on a dataset. You can try replacing 2nd line of code with the following line.
labels = logical(randi(1,40,1)); % Training data points (X) should be equal to training labels (Y)
And the last line with the following line.
view(mdlRF.Trained{1}.CompactRegressionLearner,'Mode','graph'); % Visualising
This might meet your requirements and help you visualize your model.
참고 항목
카테고리
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!