Replace option in fitrensemble

1 view (last 30 days)
Val
Val on 9 Mar 2023
Answered: the cyclist on 10 Mar 2023
What would be the right syntax to train a regression ensemble without replacing the predictors? According to the help article on "fitrensemble", the command
fitrensemble(X, Y, 'Method','Bag','NumLearningCycles',NTREE, 'Replace','off', 'Resample','on')
should do it. However, when I look at trees generated by the function, I find that some predictors are used multiple times. Is there a way to avoid it?
Thanks.

Answers (1)

the cyclist
the cyclist on 10 Mar 2023
I'm confused.
It sounds like you saying that you don't want a given predictor to occur at different branching points. For example, you are trying to avoid a model where the first branching point could be a split between x<0 and x>=0, and then a later branching point further splits the x>=0 branch between x<15 and x>=15. Is that right?
I'm not an expert in the fitrensemble function, but I'm pretty sure that that has nothing to do with the resample/replace parameters you are setting. Resampling has to do with whether observations are resampled, not whether predictors are "re-used".
Or maybe I am just totally misunderstanding what you want.

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!