SVM error when using the R2013b MATLAB version - matlab

I am trying to compute the accuracy of the HMAX model. First, I used a simple nearest Neighbor Classifier, secondly the Support Vector Machine (SVM) classifier.
In my laptop, I have the 7.6.0(R2008a) MATLAB version, and I obtained great values of accuracy by using either the nearest neighbor or svm classifer. When I moved to work on my friend's laptop in which the R2013b matlab version is installed instead of 7.6.0(R2008a), I always got the same error by using the svm classifer.
Error in mexSVMTrain (line 1)
function [AlphaY, SVs, Bias, Parameters, nSV, nLabel] = mexSVMTrain(Samples, Labels, Parameters, Weight, Verbose)
Output argument "AlphaY" (and maybe others) not assigned during call to
"C:\Users\xxxx\Documents\MATLAB\aub matlab\osu-svm\mexSVMTrain.m>mexSVMTrain".
Please I need your help in order to resolve this problem. Any help will be very appreciated.

It's not a solution to your problem. Seems like the existed mexSVMTrain.dll in the old version Matlab needs to be recompiled to work in the new released version, but it is unclear how it is recompiled without any C source code for mexSVMTrain from OSU_SVM.
I would suggest you use libsvm for the SVM part instead.

Related

Matlab, an error after using fitctree function

I am trying to construct a decision tree. I tried using the fitctree function and wrote:
ctree = fitctree(TrainingX,TrainingY);
such that TrainingX is the input matrix and TrainingY is the target matrix. An error appears saying that:
Undefined function 'fitctree' for input arguments of type 'double'.
I don't know what is the problem and what should I do to solve it. Could you please help me?
The reason why it is undefined is because fitctree requires the Statistics Toolbox in MATLAB. If you don't have the Statistics Toolbox, you can't use this function and you're SOL. Sorry!
Even with the Statistics Toolbox, fitctree is only available for recent editions of MATLAB (R2014a+). Check the release notes on the Statistics Toolbox for more details: http://www.mathworks.com/help/stats/release-notes.html. Go to where R2014a is and fully expand out all of the facts by clicking on Expand All. Where you see "Functions for classification methods and clustering", you'll see an entry for fitctree there.
The only option would be to upgrade your version of MATLAB to at least R2014a or above.
Good luck!

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.

my model is predicting all positive class to negative class in libsvm toolbox matlab

I created a classifier using libsvm toolbox in Matlab. It is classifying all positive class data as negative class and vice versa. I got good result while doing cross validation but while testing some data I am finding that classifier is working in wrong way. I can't seem to figure out where the problem lies.
Can anybody please help me on this matter.
This was a "feature" of prior versions of libsvm when the first training example's (binary) label was -1. The easiest solution is to get the latest version (> 3.17).
See here for more details: http://www.csie.ntu.edu.tw/~cjlin/libsvm/faq.html#f430
Suppose you have 500 training instances. 250 will be positive and other negative. Now in the testing set, the instances which have same features as positive will get predicted as positive. But when you are supplying testing labels (you have to provide testing labels so that LIBSVM can calculate accuracy, they won't obviously be used in the preiction algorithm) to LIBSVM, you have provided exactly reverse labels (by mistake). So you have a feeling that your predicted labels have come out exactly opposite. Because even a random classifier will have a 50% accuracy for a binary classification problem.

libsvm differences in accuracy between cmd line, weka and 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.

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