I'm using libsvm to perform binary classification. I used easy.py for training which is included in libsvm library. After running easy.py, it showed the following in stdout.

Cross validation...
Best c=8192.0, g=8.0 CV rate=93.3155
Output model: parameters.data.model

The svm model file is generated, and the accuracy looks good. So I used svm-predict (executable file) to see if the generated SVM really classifies data. Here, the test data I used is exactly the same as the one I used for the training.

However all test data is classified as label 0. and the accuracy shown is really low. The command I executed is something like following.

python easy.py parameters.data
# model and scale files are generated

./svm-predict parameters.data parameters.data.model svmpredict_output.log
# svmpredict_output.log is all 0

Am I doing something wrong?


1 Answer 1


Ok, sorry. My stupid mistake.

The svm used scaled dataset for training, but I was using un-scaled dataset for test data.

./svm-predict parameters.data.scale parameters.data.model svmpredict_output.log

Like above, everything works well. (extension like *.scale, *.data should be the same if you're using easy.py)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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