libsvm differences in accuracy between cmd line, weka and matlab - matlab

I'm doing some preliminary testing with 2 classes of vectors, trying to separate them with libsvm. I get a 78.2% correct ID rate in Matlab and at the cmd line (using libsvm), but in Weka I get around 95%.
No cross-validation was done in Weka; just trained model and then read in test dataset and classified it.
Can anyone offer an explanation? Thanks in advance.

If you didn't provide a separate Test Data , the validation Folds should be set, 10 or desired value. however, be sure that the same SVMType and kerneltype are being used in both program. by default Weka uses C-SVC with radial basis function.

Related

support vector machine regression & prediction using MATLAB fitrsvm function

I'm relatively new to using SVM and I have a question regarding how to use the results of the SVM regression. I have found many easy-to-understand documentation on SVM classification, and I can understand how to use the result of SVM for binary classification (i.e. data on one side of the support vector is labeled as one, data on the other side of the support vector is labeled as another), but I have no been able to find such hints on SVM regression- which is why I have run into the following question:
Using both libsvm package and the fitrsvm function in MATLAB, I was able to successfully generate models that are capable of fitting the abalone data set. the result of the libsvm (using svmtrain function) was used along with svmpredict to the successfully predict with new input parameters as followed:
model=svmtrain(age_train,X_train,['-s 3 -t 2 -c 2 -g 2']);
[prediction,accuracy,~]=svmpredict(age_eval,X_eval,model);
Also, as I've said, I was able to achieve the same results using the fitrsvm function as followed:
model1=fitrsvm(X_train,age_train,'OptimizeHyperparameters','auto',...
'HyperparameterOptimizationOptions',struct('AcquisitionFunctionName',...
'expected-improvement-plus'),'KernelFunction','rbf');
age_predict1=predict(model1,X_eval);
Now my question is, how do the svmpredict function (in the case of libsvm package) and the predict function (in the case of fitrsvm function in MATLAB) take the values within the trained models and apply them to the new input data? For example, is there a mathematical equation in which I apply the parameters of the trained model (such as the 'Mu' and the 'Sigma' parameters in the fitrsvm result) to the new input data to obtain the results?
It would be greatly appreciated if someone could help me with this or refer me to someone/somewhere who can help me, thank you very much in advance.

libSVM outputs "Line search fails in two-class probability estimates"

When I tried to train a SVM(trainsvm function) with RBF kernel,
The libSVM library outputs "Line search fails in two-class probability estimates" during training.
After training, the training accuracy of the model is just 20%.
I think I might miss something and it is related to the message.
For more information about my project,
I'm dealing with PASCAL VOC action classification problem.
I'm trying to follow this method.
http://www.ifp.illinois.edu/~jyang29/papers/CVPR09-ScSPM.pdf
There are 1300 training images and 11 classes.
After making codebooks and sparse coding,
The dimension of feature vector is 2688.
The number of training example is 1370.
You need to do a grid search, either using cross validation, or using a separate validation data set to get good values for C and gamma. Libsvm has a script called grid.py that is useful for this. I noticed you tagged this with matlab, using grid.py needs command line tools and a python installation (IMO this generally works out better than with matlab, especially if you have a some big machines to run many jobs in parallel).
I recommend that you read the libsvm guide if you haven't already done so: http://www.csie.ntu.edu.tw/~cjlin/papers/guide/guide.pdf‎.
I also suggest you initially use the same dataset as used for the paper as occasionally published algorithms only work well on the dataset chosen for the paper.
Lastly, you could contact the authors of the paper.
I asked about this warning the author of LIBSVM, and he replied that this warning can be ignored.

Testing with LIBSVM

I have been using libsvm in Matlab for our research. The accuracies of the model when used in cross-validation results are already quite good. However, I am having a small problem when trying to use the (already-trained) model for prediction. The svmpredict command requires us to specify the correct testing label (to be used for measuring accuracy) however I want deploy the model to classify new data (with unknown label), so of course there is no label for this testing data. Can I call svmpredict without specifying the (target) label of the testing data? How do I deploy the models that I have obtained in a production setting?
I don't know about matlab, but in python you have the same situation. It really doesn't matter and you can predict with that value, just ignore the accuracy value on the output.

Libsvm vs Weka (WLSVM)

I've got to deal with an unbalanced dataset (95% record of negative class and 5% positive). I developed a model using decision tree and Weka framework. Now I'd like to try SVM and Libsvm to get better results. I'm trying to use Libsvm for matlab an Libsvm weka wrapper. I'd like to know how to compare results that I get from them. In weka a model is built from the whole dataset and after a 10-fold cross validation is performed. How can I do it with Libsvm? From Libsvm FAQ's I discovered that CV is made only to discover best parameters for kernels,not during train/predict, so what is the exact sequence of action that I should do in Matlab to obtain similar results in order to compare them with Weka?

How to train SVM in matlab for character recognition?

Im a final year student working on my major project. My project is basically to extract text from a natural scene, and recognize it and then display them in a notepad etc..
I have already extracted the text form the images and have also obtained 85 features for each character which is extracted.
How ever, for the recognition part, I have no clue as of how to train or use SVM(support vector machines) in matlab so I can get a match.
Please help me out as this is turning out to be painstakingly difficult
If you're happy with using an existing SVM implementation, then you should either use the bioinformatics toolbox svmtrain, or download the Matlab version of libsvm. If you want to implement an SVM yourself then you should understand SVM theory and you can use quadprog to solve the appropriate optimisation problem.
With your data, you will need to have an N-by-85 feature matrix, where N is a number of characters, and an N-by-1 array of 'true labels' which you provide manually. Depending on which tool you use to train an SVM, the paramaters to svmtrain are slightly different - check the documentation.
If you want to evaluate your SVM to show that it works, you may need to organise your data such that you can estimate the generalization error of classifier - see cross-validation