I wanted to use libsvm in visual studio 2010 just for classifying my test sample and nothing more ..
I've worked with libsvm using the documentation provided by its official site ...
So I used these steps sequentially
1). svm-scale -l 0 -s range train.txt> train.scale
2). svm-scale -r range test.txt> test.scale
3). grid.py -svm-train "MYSVM_TRAIN_PATH" -gnuplot "MY_GNUPLOT_PATH" train.scale
4). svm-train -c 32 -g 0.05 -b 1 train.scale train.model
5). svm-predict test.scale train.model test.out
and it worked pretty well , but the problem is that I don't know how to do these steps in visual studio ... I just loaded my train.model (step 4) from above, and did not repeat the training procedure in VS10 .... here it's my code :
void main(){ svm_model *Model; Model = svm_load_model("train.model");//loaded from svm-train (step4 above) svm_node x[feature_size]; (Some internal Process for obtaining new feature vector for testing) double result = svm_predict(Model,x); std::cout<<"result is"<<result<<std::endl; return 0}
but this does not result as python code , in python I get 98% precision for my test data but in here it's less than 20%!!!! it's somehow aweful ...
I also used OPENCV for training my data and testing my samples (Using ml.h) but in OPENCV ,I got 70 % accuracy. and it's still more than 20% reduction from my real result !!!!
I think the problem is in the scaling .. because in both svm.h and OPENCV I didn't find any function for scaling my train and test data .....