Effacer les filtres
Effacer les filtres

Not reproducibility in Random Forest with Hyperparameters

2 vues (au cours des 30 derniers jours)
Esmeralda Ruiz Pujadas
Esmeralda Ruiz Pujadas le 5 Juil 2022
Hello, I tried many ways to apply random forest with hyperparameters and reproduce the results and no chance. I have added as the manual says: rng('default') before the cross validations and the classifier. If I do not use hyperparameters, it works. The problem is when I use grid search. I use expected-improvement-plus for reproducibility. But it does not work. For svm or any other machine learning method I did not have this issue. Only in random forest.
Thank you
myopts = struct('Optimizer','gridsearch','UseParallel',true,'AcquisitionFunctionName','expected-improvement-plus', 'ShowPlots',false);
rng('default');
classificationRF = fitcensemble(...
predictors, ...
response, ...
'Method', 'Bag', ...
'NumLearningCycles', 30, ...
'Learners', template, ...
'ClassNames', [1; 2; 3; 4; 5],'OptimizeHyperparameters',{'NumLearningCycles','MaxNumSplits'},'HyperparameterOptimizationOptions',myopts);

Réponse acceptée

Alan Weiss
Alan Weiss le 6 Juil 2022
In creating your template for training, did you set the Reproducible name-value argument to true? Also, for your parallel options, to compute reproducibly I think that you need to set UseSubstreams to true and set the stream to a type that works with substreams, as shown in the documentation.
Alan Weiss
MATLAB mathematical toolbox documentation
  1 commentaire
Esmeralda Ruiz Pujadas
Esmeralda Ruiz Pujadas le 12 Juil 2022
Thank you very much. Yes I used Reproducible but not UseSubstreams. I will try that. Thank you very much

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by