Building random forest with cross-validation
16 ビュー (過去 30 日間)
古いコメントを表示
Steven Niggebrugge
2020 年 7 月 25 日
回答済み: Ayush Aniket
2025 年 6 月 10 日 5:57
Hi,
i have been wondering for some time now how random forests (Bagging, or AdaBoost, doesn't matter) are built when using cross-validation.
Let's see we're using 5-fold cross validation to train random forests on 5 different training sets and therefore test on 5 different test sets.
How does the 'final' random forest look like when we are basically building 5 random forests (one for each fold of the cross validation). How are these forests combined into a final model?
I have never understood this step and I really hope someone can help me with this!
thanks in advance,
Steven
0 件のコメント
採用された回答
Ayush Aniket
2025 年 6 月 10 日 5:57
The models used in cross validation (5, as you mentioned) are not directly combined into a single final model.
The goal of cross-validation is to evaluate the model's performance across different data splits, ensuring it generalizes well. After cross-validation, you discard the five individual models.You train a new random forest on the entire dataset using the best hyperparameters found during cross-validation. This final model is used for predictions.
Refer the following example to read the workflow of training a final model after evaluating and finding hyperparameters through cross-validation: https://www.mathworks.com/help/stats/classificationsvm.crossval.html#mw_e9fd437d-4125-4b9e-b87c-f370bc439a3e
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Statistics and Machine Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!