SVM: Classify using LearnerWeights

6 views (last 30 days)
Elisabetta Besana
Elisabetta Besana on 26 Mar 2017
Edited: Johanna Richter on 19 Oct 2020
I used fitcecoc to train a multiclass svm algorithm on MATLAB, the resulting struct has all the weights and the bias. Which formula should I use to classify a new data x without using predict? I've tried this one: f=x'*weight+bias but it doesn't work. Please help! Thank you!!
  1 Comment
Johanna Richter
Johanna Richter on 19 Oct 2020
Edited: Johanna Richter on 19 Oct 2020
fitcecoc trains several binary models which you can get seperately with Mdl.BinaryLearners. They each contain weight and bias for one binary learner. You can check which binary learner put which classes of data into one class for learning by checking Mdl.CodingMatrix.
Check the MATLAB documentiation for the object -CompactClassificationECOC-. This is the object your model is when learned with fitcecoc (when trained with the corresponding options, but the other ones are not very different regarding the return values). There you can read all about how your model is constructed.
There is a reason there is the function predict. A multiclass modell is complicated, especially if you don't use onevsone, or expand to kernel functions and other options!

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!