What is the difference form using TreeBagger and Fitrensemble functions

조회 수: 21 (최근 30일)
Tiago Dias
Tiago Dias 2020년 4월 30일
답변: Raunak Gupta 2020년 5월 3일
Hi, I am wondering what is the difference between (1) and (2).
I am trying to construct a predictive model, and I don't understand if I should get the same results with (1) and (2) or if they are different.
1) template = templateTree('NumVariablesToSample','all','MinLeafSize',5);
ensemble = fitrensemble(X,Y,'Method','Bag','NumLearningCycles',100,'Learners',template);
Ypred_test = predict(ensemble, XTest);
2) ensemble = TreeBagger(100,X,Y,'method','regression','NVarToSample','all','OOBPredictorImportance','on');
Ypred_test = predict(ensemble, XTest);
Thanks for your time.

답변 (1개)

Raunak Gupta
Raunak Gupta 2020년 5월 3일
Hi,
In above case the output model as well as result will be different because both TreeBagger and fitrensemble uses different algorithm for optimization. Tree Bagger uses Node Splitting Rules whereas fitrensemble uses Ensemble Algorithms. So, it is expected the output will be different.
You may choose between the two based on difference mentioned in Comparison of TreeBagger and Bagged Ensembles.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by