Can i use FitPosterior for a cell?

3 次查看(过去 30 天)
Hi, i am doing a projects in which i need to use fitposterior for my multiclass svm, but when i use it i get an error that says "Undefined function 'fitPosterior' for input arguments of type 'cell'", what can i do in order to solve this problem? Do i need to change my svm from a cell type to another? If so can someone tell me how to do it?
Thanks

回答(1 个)

Yash Sharma
Yash Sharma 2024-2-13
Hi Fabrizo,
The error message you're seeing indicates that fitPosterior is being called with an input argument of type 'cell', which is not supported. fitPosterior is a MATLAB function that adjusts the posterior probabilities of a binary classifier trained using fitcsvm. It is not directly applicable to multiclass SVMs or cell arrays.
If you have a multiclass SVM model, you need to ensure that you're working with an SVM model object, not a cell array.
To convert a multiclass SVM model into individual binary SVM model objects, you would typically need to train binary classifiers separately for each class pair. However, this is not practical or necessary for most applications because fitcecoc handles the multiclass problem internally.
If you're trying to adjust posterior probabilities for a multiclass SVM model created with fitcecoc, you can't directly use fitPosterior because it's designed for binary classification. Instead, you can use the predict function, which provides the scores or posterior probabilities as part of its output.
Hope it Helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by