Laplace Kernel in Matlab Libsvm - matlab

Does anyone knows how I will study the laplace kernel on matlab with the library LIBSVM?
LIBSVM doesn't have laplace kernel orginally. Is there anyway to use it?

Yes, it is possible.
You will need to read the documentation of LIBSVM, in particular the README file has a section on Precomputed Kernels where it explains how to do it. You can do it from Matlab, in that case you will need to also read the examples on the usage of precomputed kernels, again in the MATLAB README file of LIBSVM.
That being said, and I know you're not asking for advice, but this probably isn't the first thing to try, the first thing to try is to use the RBF kernel which is almost identical to the Laplacian kernel except in some minor technical details.

Related

Why is SIFT not available in Matlab?

SIFT is an important and useful algorithm in computer vision but it seems that it is not part of Matlab or any of its toolboxes.
Why ? Does Matlab offer something better or equivalent ?
MATLAB has SURF available as part of the Computer Vision Toolbox but not SIFT: http://www.mathworks.com/help/vision/ref/surfpoints-class.html. However, both algorithms are pretty much the same with some minor (but crucial) differences, such as using integral images and a fast Hessian detector. I won't go into those differences in any further detail, but you can certainly read up on the work here: http://www.vision.ee.ethz.ch/~surf/eccv06.pdf. As to the reason why MathWorks decided to use SURF instead of SIFT... it could be any reason really. AFAIK, there is no official reason why one was chosen over the other as they are both subject to being patented.
However, if you want to use SIFT within MATLAB, one suggestion I have is to use the VLFeat toolbox where a C and MATLAB implementation of the keypoint, detection and matching framework has been made available and is open source. It also has a variety of other nice computer vision algorithms implemented, but VLFeat is one of the libraries that I know of that manages to compute SIFT as accurately as the original patented algorithm.
If you're dead set on using SIFT, check VLFeat out! Specifically, check out the official VLFeat tutorial on SIFT using the MATLAB wrappers: http://www.vlfeat.org/overview/sift.html

Levenberg-Marquardt optimization

Anyone knows where I cand find an .m (matlab ) file with the Levenberg-Marquardt moditication to the Newton's method to optimize a function?
Thanks
I always start with a search on file exchange. Found a LMF nonlinear solution. It also seems that there is a lsqnonlin function in The optimization toolbox. Of course that costs a small fortune and limits the portability of your code (one of many reasons I use Python these days).
You can try using the MATLAB MEX version of CMPFIT, if that fits your purpose.
Try it here: http://people.cas.uab.edu/~mosya/cl/MATLABcircle.html
This is a web-page from proffesor Chernov, who published some papers and a book on the matter. There are also c and matlab sources.

Which is a better method? libsvm or svmclassify?

I have been recently trying to use svm for feature classification. While i was doing so, a question came to my mind.
Which would be a better method to use, LIBSVM or svmclassify? What I mean by svmclassify is to use in-built functions in MATLAB such as svmtrain and svmclassify. In that sense, I was interested to know which method would be more accurate and which would be easier to use.
Since MATLAB has already the Bioinformatics toolbox already, why would you use LIBSVM? Aren't the functions like svmtrain and svmclassify already built in.. what additional benefits does LIBSVM bring about?
I would like to hear some of your opinions. Please Pardon me if the question is stupid..
I expect you would get very similar result using each library.
They are both very easy to use. The only big difference is that one comes with the MATLAB Bioinformatics toolbox and the other one you need to obtain from the authors web site and install by hand. If to you this is an issue I would recommend you stick to what is already installed in your computer. If not consider using LIBSVM, as it is a very well tested and well regarded library.
Also, from personal experience on playing with both, libSVM is much faster than MATLAB svm routines for obvious reasons. Last but not the least, libSVM has MATLAB plugins which can be called from MATLAB if you are more comfortable within a MATLAB environment.
I have also the same question, but I think that Libsvm is very useful and very easy in the case of multi-classes classification , but the matlab toolbox is designed for only two classes classification.
In my experience the libsvm performed giving cross validaion results as 45% where matlab code did 90%. So I looked up the explanation of matlab function for svm where they had such options related with perceptrones, I wonder if they are using pure svm or not but will write again in my case matlab was much better. (multiclass svm)

ICA (Independent Component Analysis) in matlab

Could you provide an example of ICA Independent Component Analysis IN MATLAB?
I know PCA is implemented in matlab but ICA, what about RCA?
Have a look at the FastICA implementation. I've used their R version before, I assume the matlab implementation does the same thing... On that page you get a description of the algorithm and pointers to more info.
Dr G was right.
Now, you are able to find a complete and a very useful Matlab Package (works also with 2013a version):
FastICA
Also you can find a another ICA and PCA Matlab implementation package there: ICA/PCA. But I have no experience with it.
The topic is quite old, but it is worth mentioning that in 2017a, matlab introduced reconstruction independent component analysis (RICA), which may come in handy for someone searching for ICA.

Feature Selection methods in MATLAB?

I am trying to do some text classification with SVMs in MATLAB and really would to know if MATLAB has any methods for feature selection(Chi Sq.,MI,....), For the reason that I wan to try various methods and keeping the best method, I don't have time to implement all of them. That's why I am looking for such methods in MATLAB.Does any one know?
svmtrain
MATLAB has other utilities for classification like cluster analysis, random forests, etc.
If you don't have the required toolbox for svmtrain, I recommend LIBSVM. It's free and I've used it a lot with good results.
The Statistics Toolbox has sequentialfs. See also the documentation on feature selection.
A similar approach is dimensionality reduction. In MATLAB you can easily perform PCA or Factor analysis.
Alternatively you can take a wrapper approach to feature selection. You would search through the space of features by taking a subset of features each time, and evaluating that subset using any classification algorithm you decide (LDA, Decision tree, SVM, ..). You can do this as an exhaustively or using some kind of heuristic to guide the search (greedy, GA, SA, ..)
If you have access to the Bioinformatics Toolbox, it has a randfeatures function that does a similar thing. There's even a couple of cool demos of actual use cases.
May be this might help:
There are two ways of selecting the features in the classification:
Using fselect.py from libsvm tool directory (http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/#feature_selection_tool)
Using sequentialfs from statistics toolbox.
I would recommend using fselect.py as it provides more options - like automatic grid search for optimum parameters (using grid.py). It also provides an F-score based on the discrimination ability of the features (see http://www.csie.ntu.edu.tw/~cjlin/papers/features.pdf for details of F-score).
Since fselect.py is written in python, either you can use python interface or as I prefer, use matlab to perform a system call to python:
system('python fselect.py <training file name>')
Its important that you have python installed, libsvm compiled (and you are in the tools directory of libsvm which has grid.py and other files).
It is necessary to have the training file in libsvm format (sparse format). You can do that by using sparse function in matlab and then libsvmwrite.
xtrain_sparse = sparse(xtrain)
libsvmwrite('filename.txt',ytrain,xtrain_sparse)
Hope this helps.
For sequentialfs with libsvm, you can see this post:
Features selection with sequentialfs with libsvm