How to define the Min LeafSize of a Random Forest

11 ビュー (過去 30 日間)
Paul Muster
Paul Muster 2020 年 12 月 3 日
コメント済み: Paul Muster 2020 年 12 月 3 日
Hallo,
I want to create a random forest with a min MinLeafSize of 15.
I have tried that:
Mdl = fitcensemble(X,Y,'Learners','tree','OptimizeHyperparameters',{'MinLeafSize',15})
However, it doesn't work.
Does anyone know how to change it?

回答 (1 件)

Cris LaPierre
Cris LaPierre 2020 年 12 月 3 日
When you choose to optimize hyperparameters, you cannot specify a value for MinLeafSize. The program will try to find the best leaf size. It will ignore any other settings (see the second note under Hyperparameter Optimization Options)
If you don't use hyperparamter optimization, then you can set the min leaf size. From the 'Algorithm' section of the fitcensemble documentation:
"If you set Method to be a boosting algorithm and Learners to be decision trees, then the software grows shallow decision trees by default. You can adjust tree depth by specifying the MaxNumSplits, MinLeafSize, and MinParentSize name-value pair arguments using templateTree."
  1 件のコメント
Paul Muster
Paul Muster 2020 年 12 月 3 日
Thanks for your answer.
So this is it:
t = templateTree('MinLeafSize',15);
mdl = fitcensemble(X,Y,'Learners',t);

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeClassification Ensembles についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by