Solved – Classification score: SVM

classificationmachine learningsvm

I am using libsvm (which is meant for solving binary classification problems) for multi-class classification. How can I get classification scores / confidences for each class to effectively compare them given that libsvm can only produces scores for two classes. Desired output:

Class 1: score1

Class 2: score2

Class 3: score3

Class 4: score4

Best Answer

If I understand your question, you can pass the -b flag with option 1 when building the model like this:

../svm-train -b 1 data_file

And then when creating the prediction vector, you do the same:

../svm-precict -b 1 test_file data_file.model output_file

Here is an output_file example that has 3 classes:

labels 0 -1 1
0 0.635655 0.18753 0.176816