5
$\begingroup$

I have about 5544 runs where I am trying to classify it as failure or success. Here the number of runs that lead to failure is only 64 and rest is sucess. In that case when I try to use SVM should I make the number of classes equal? Will this affect the results?

$\endgroup$
3
  • 6
    $\begingroup$ Yes. Such data is called unbalanced/imbalanced data. Usually making the number of points per class equal helps a great deal in getting a better classifier. But then, not necessarily the best classifier. You need to try several things here, 1] Try uniformly randomly choosing 64 points from success class and training your SVM 2] Compute the mean of the failure class and choose 64 points from success class which are closest to the failure mean 3] If you are using libSVM, use the entire dataset and provide class weights proportional to the imbalance that you observe $\endgroup$ Commented Nov 18, 2012 at 17:33
  • $\begingroup$ @TenaliRaman Thanks for the same.I am using libSVM.Can you please tell me or redirect me to some URL where I can learn about how to provide class weights propotional to imbalance. $\endgroup$ Commented Nov 18, 2012 at 22:04
  • 2
    $\begingroup$ If you check the options of libSVM you will see the -wi option. In your case, (5544 - 64)/64 = 85.625. So, if your label for failure is 0 and success is 1, then you can add the option -w0 85.625 to your libSVM command. $\endgroup$ Commented Nov 19, 2012 at 3:36

2 Answers 2

1
$\begingroup$

Yes, for a detailed explanation refer to the paper "A geometric interpretation of $\nu$-SVM Classifiers" by David J. Crisp and Christopher J.C. Burges. The idea is that $\nu$ is bounded by the amount $\nu \leq 2l_{min}/l$, where $l_{min}$ is the amount of sample points of the smallest set, and $l$ is the total amount of points.

In an unbalanced problem this amount is very small. At the same time $\nu$ is an upper bound on the fraction of margin errors and a lower bound on the fraction of support vectors. So actually you might end up with a big number of SVs, because the fraction of margin errors is forced to the too low.

See "A User's Guide to Support Vector Machines" by Asa Ben-Hur and Jason Weston for a method to deal with this problem.

$\endgroup$
0
$\begingroup$

Thanks to @TenaliRaman for his answer.I am copying the same.

Yes. Such data is called unbalanced/imbalanced data. Usually making the number of points per class equal helps a great deal in getting a better classifier. But then, not necessarily the best classifier. You need to try several things here, 1] Try uniformly randomly choosing 64 points from success class and training your SVM 2] Compute the mean of the failure class and choose 64 points from success class which are closest to the failure mean 3] If you are using libSVM, use the entire dataset and provide class weights proportional to the imbalance that you observe

If you check the options of libSVM you will see the -wi option. In your case, (5544 - 64)/64 = 85.625. So, if your label for failure is 0 and success is 1, then you can add the option -w0 85.625 to your libSVM command

$\endgroup$

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