How do I make the results of a boosted classification tree reproducible?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to use fitcensemble to design a boosted classification tree. I have 11 classifiers and about 1000 observations. Here is my codre:
rng(1);%For reproducability
t = templateTree('Reproducible',true);
LTAFtreeBoost=fitcensemble(cleanTable(trainingRows,2:n),formula,...
'Learners',t,'OptimizeHyperparameters','auto','Cost',costMatrix,...
'NumLearningCycles',100)
figure;bar(categorical(LTAFtreeBoost.PredictorNames),predictorImportance(LTAFtreeBoost))
title('Predictor Importance');
The problem is, I get a different classifier every time I run the code. I need to be able to change other parts of my script and not have the classifier change. Any suggestions?
0 Kommentare
Antworten (1)
Drew
am 18 Okt. 2022
The different results are likely coming from randomization in the hyperparameter optimization. https://www.mathworks.com/help/stats/fitcensemble.html
If you would like to get the same classifer every time, then don't run hyperparameter optimization every time. Call fitcensemble with the particular parameters desired for your final model.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Classification finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!