Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

unexpected performance using SVM with RBF kernel

I am kind of new to svm classification. I am trying to use opencv svm classifier to do some face recognition. The input feature parameters are normalized Local binary pattern. So all values are from 0-1. I first tried linear kernel to train the classifier and then use the training data set to test set. I got 100% accuracy. However, when I changed kernel to RBF (all other parameters are default) and re-test the training set, all cases are classified to one class which means they are not separable. I tried different gamma values from 0.000001 to 10. Does anyone have idea about this issue? Thanks.

unexpected performance using SVM with RBF kernel

I am kind of new to svm classification. I am trying to use opencv svm classifier to do some face recognition. The input feature parameters are normalized Local binary pattern. So all values are from 0-1. I first tried linear kernel to train the classifier and then use the training data set to test set. I got 100% accuracy. accuracy ( I know it means nothing). However, when I changed kernel to RBF (all other parameters are default) and re-test the training set, all cases are classified to one class which means they are not separable. I tried different gamma values from 0.000001 to 10. Does anyone have idea about this issue? Thanks.

unexpected performance using SVM with RBF kernel

I am kind of new to svm classification. I am trying to use opencv svm classifier to do some face recognition. The input feature parameters are normalized Local binary pattern. So all values are from 0-1. I first tried linear kernel to train the classifier and then use the training data set to test set. I got 100% accuracy ( I know it means nothing). However, when I changed kernel to RBF (all other parameters are default) and re-test the training set, all cases are classified to one class which means they are not separable. I tried different gamma values from 0.000001 to 10. Does anyone have idea about this issue? Thanks.

CvSVMParams param;
param.svm_type = CvSVM::C_SVC;
param.kernel_type = CvSVM::RBF; //CvSVM::RBF, CvSVM::LINEAR ...
param.degree = 2; // for poly
param.gamma = 0.000000001; // for poly/rbf/sigmoid
param.coef0 = 1; // for poly/sigmoid

param.C = 0.5; // for CV_SVM_C_SVC, CV_SVM_EPS_SVR and CV_SVM_NU_SVR
param.term_crit.type = CV_TERMCRIT_EPS;//CV_TERMCRIT_ITER +CV_TERMCRIT_EPS;
param.term_crit.max_iter = 1000000;
param.term_crit.epsilon = 1e-9;
SVM.train(trainingDataMat, labelMat, Mat(), Mat(), param);

for(int i=0; i<trainingDataMat.rows; i++){
    Mat sampleMat = trainingDataMat(Range(i,i+1), Range::all());
    double response = SVM.predict(sampleMat);
    cout<<"test"<<i<<"=  "<<response<<endl;
}