A wrong confusion matrix for SVM in weka


I have an unballanced data set as below.


I used the SVM from Weka to build a model as descibed below but the result of the confusion matrix is very bad.Is there any explanation to this behaviour in the SVM model?

When I used the inherent SVM of Knime I got similar behaviour.


Hi Zied,

Without knowing anything about the actual classification problem, the data and the settings you used, it is hard to give an explanation for these results.

That being said, there are some things you can try that might tweak your prediction accuracy:

  • Normalize your data
  • Try different parameters, e.g. kernel types
  • Weight your classes, put higher weights on underrepresented classes

If you are new to SVM, this paper might be a good read for you: https://www.csie.ntu.edu.tw/~cjlin/papers/guide/guide.pdf

Hi zizoo,

The reason for bad performance of both classifiers is the heavily unbalanced data. To address this problem one can assign different weights to your classes. You can do it using the “weights” option, available in the Weka LibSVM configuration dialog.

You might also want to check the documentation regarding the LibSVM library.


Hi Anna,
I tried to add the weights but it seems that dialog box does not allow me to put the weight for each class.
Should I follow the order of classes that I see in the scorer node? How to ensure that I am entering the right order?