How to set “ScoreTransform” of function “fitcensemble” with "AdaBoostM2" in order to output probability when making prediction ?
5 views (last 30 days)
Show older comments
I am doing Multicalssification with fitcensemble. I want to output probability as [pred, prob] = mdl.predict(X) with mdl trained by fitcensemble with "AdaBoostM2". I tried to set "Score Transform" with value "logit" and "doublelogit". However, the row sum of their outputs doesn't equal to 1. Could anyone please let me know how to probably set the ScoreTransform parameter to get probability ?
0 Comments
Answers (1)
Ayush Aniket
on 29 Aug 2025 at 11:19
fitcensemble with AdaBoostM2 is not a probabilistic model. It outputs classification scores (margins), not calibrated probabilities.The ScoreTransform option ('logit', 'doublelogit', etc.) just applies a monotone mapping to those scores.It does not normalize them into probabilities that sum to 1 across classes.That’s why your row sums are not equal to 1.
You can try the following steps:
1. You can use a learner/ensemble that supports posterior probabilities. For example:
mdl = fitcensemble(X, Y, 'Method', 'Bag');
[pred, prob] = predict(mdl, X);
2. Train your AdaBoost model, then fit a calibration model (e.g. logistic regression or isotonic regression) to map raw scores to probabilities.In MATLAB, this is available via:
mdl = fitcensemble(X, Y, 'Method','AdaBoostM2');
mdlCal = fitSVMPosterior(mdl); % or fitcecoc + fitPosterior
[pred, prob] = predict(mdlCal, X);
Though fitSVMPosterior works mainly for SVM, the idea is similar: you need a separate calibration step.
3. Wrap AdaBoost inside fitcecoc, then use fitPosterior to calibrate:
t = templateEnsemble('AdaBoostM2',100,'Tree');
mdl = fitcecoc(X, Y, 'Learners', t);
mdl = fitPosterior(mdl, X, Y);
[pred, prob] = predict(mdl, X);
0 Comments
See Also
Categories
Find more on Classification Ensembles in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!