How do I make the results of a boosted classification tree reproducible?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Drew
el 18 de Oct. de 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 comentarios
Ver también
Categorías
Más información sobre Classification en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!