Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

results on libsvm favors only one class from two classes

Tags:

svm

i'm having a weird result on my data, i wonder if you or anyone else may have any insights to it.. i have around 5000 data with around 16000 attributes,i trained my RBF svm (i'm using libsvm on matlab) with 2000 data for each class (i have only two classes) and test it with the rest (around 1000 data).

the weird part is all of the prob estimates of the result has the same value and hence 100% test data that belong to one class resulted in correct prediction and 100% of the rest resulted in wrong, it's like no matter what the input is,it will predict the first class..

i tried cross validation to find the best parameter for the RBF but the accuracy didn't go far from 50% (which you can guess why,half 100% correct and half 100% wrong),the biggest accuracy was 51.25%.

I then tried linear SVM and even though the prob estimates are at least not the same value as before,the result still showed the same trend,although not 100% as before (97% for one class and 4% for the other),so yeah,the main problem is that it favors one class,no matter what the test data is.

i haven't tried to center or scale the data,would that make any difference?

do you guys have any idea? i'd really appreciate it. thanks.

like image 627
ahmad sayyid Avatar asked Oct 04 '22 17:10

ahmad sayyid


1 Answers

Several things may be going wrong but here are the main things you seem to be missing:

  1. Scale your data: yes, it's that important. It can make a significant difference in the performance of the resulting classifier. A good example of this is available in the beginner's guide made by the LIBSVM authors (appendix B). Make sure to use the same scaling factors on both training and test data.
  2. You did not tune the C parameter. Based on your description, it sounds like C is too low. This leads to a classifier with very simple parameters (alphas) but a large amount of misclassifications. The guide also contains a good explanation about why and how parameter tuning is done.
like image 199
Marc Claesen Avatar answered Oct 12 '22 11:10

Marc Claesen