1
$\begingroup$

If I fit an SVM to imbalanced data (e.g. two classes and a sample where more than 90% belong to class 1 and only 10% to class 2) it may happen that the classifier simply classifies all cases as class 1. This problem can be handled by specifying costs and/or resampling, but I would like to know whether the classifier has such a simple form. Is there a way to check for this in a "simple" form (e.g. by looking at output objects in Python Scikit)?

$\endgroup$
1
$\begingroup$

I suppose the most straight-forward way of identifying such a problem is having a look at the actual predicitons of the model. Generating a confusion matrix of your models predictions is a standard procedure for this purpose and is implemented in scikit-learn.
Having a look at the example in the wiki article helps interpreting the confusion matrix, which tells us: it shows us that 5 instances of class 'Cat' have been correctly classified as such, while 3 have been wrongly classified as 'Dog'.

If your model is really struggling with the class imbalance in the data, then you will see most instances predicted as the majority class - many wrongly so.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.