How to set “ScoreTransform” of function “fitcensemble” with "AdaBoostM2" in order to output probability when making prediction ?
5 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Ayush Aniket
2025-8-29,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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Classification Ensembles 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!