How to recursively train Treebagger preserving the information from one train data set to another one ?
Show older comments
I would like to make cross validation, for a Random Forest model, "by hand". So once I split my data into kfolds, I have to recursively train TreeBagger (https://it.mathworks.com/help/stats/treebagger.html) and then test it on one of these folds. Would it make sense to train the TreeBagger for each fold ? If I train on one train set and then I train on another one without preserving any memory of the previous training, it is like training it on just one train set... so how to recursively train Treebagger preserving the information from one train data set to another one ?
Answers (1)
the cyclist
on 23 Jan 2026
0 votes
I don't understand what you specifically mean by "recursively" in this context.
The closest idea I can think of to what you mean for "by hand" would be to use the cvpartition function to define the folds manually, and then train on a subset of folds, then test on the folds that were not used for training.
Categories
Find more on Classification Ensembles in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!