Get Posterior Probability for multi-class Linear SVM function from Classification Learner
7 views (last 30 days)
I trained a multi-class model using Matlab Classification Learner App and turned it into a function. I got predicted class and fit score from the observations.
[fitClass, fitScore]= trained_model.predictFcn(observation);
I wish to get posterior probability score for each class rather than fit scores, which are always negative.
I found this documentation https://www.mathworks.com/help/stats/fitsvmposterior.html, but when I fit in my SVM model from the learner, the function fitSVMPosterior(SVMModel) gives me the error that
ScoreSVMModel = fitSVMPosterior(SVMModel)
Error: You must pass OBJ as an SVM model or a cross-validated SVM model.
My understanding is that fitSVMPosterior function belongs to another libary, which is not compatible with the model from he Learner App. I wonder if there is a method to get poserior probability for the model trianed from Classification learner App? Or should I use other methods that have posterior probability function to train my model Thank you for your hints!
Pratyush Roy on 5 Mar 2021
The multi-class SVM in Classification Learner uses the fitecoc method to fit multiple binary SVMs to solve a multiple class classification problem.
After obtaining the classification model using the fitecoc method, one can use the predict function to obtain the posterior probabilities.
Hope this helps!