Levenberg-Marquardt optimization - matlab

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.

Related

Run OpenCL from MATLAB

I've been searching around for some way to easily interface opencl code with MATLAB code, however most of what I've found is several years old and I'm wondering if it's still applicable.
Does anyone know of a way to do this?
Have you tried the OpenCL Toolbox?
Also the MATLAB Parallel Computing Toolbox may be a useful alternative if you have the license for it.
Also see Jacket.
The last two may require you to rewrite your code in the matlab language, if that is an acceptable price.

Laplace Kernel in Matlab Libsvm

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.

Using a MATLAB code on Scilab

Is it possible to use a MATLAB code on Scilab? Is that what is meant when saying that Scilab is a "clone" from MATLAB?
There is a tool to automatically convert Matlab source to Scilab source, it's called M2SCI. A script parses the Matlab source code and replaces Matlab-specific functions by Scilab ones. See the documentation of the mfile2sci function.
Yes you can use MATLAB code on scilab. See these links for more information:
http://help.scilab.org/docs/5.4.0/fr_FR/section_36184e52ee88ad558380be4e92d3de21.html
http://help.scilab.org/docs/5.4.0/en_US/index.html
I would not bet on it. But if your code is simple enough chances are good.
Problems are:
There is encrypted p-code in Matlab that Scilab will not be able to open.
Matlab usually comes with a number of toolboxes that might not be available to you (i think especially Simulink)
last but not least (i don't know about scilab) there usually are minute differences in how functions are implemented.
There are a number of projects out there trying to replicate/replace MATLAB:
Julia language: which has a relatively similar syntax to MATLAB and offers great performance, but still lacks a lot of toolboxes/libraries, as well as not having a GUI like MATLAB. I think this has the brightest future among all MATLAB alternatives.
Python language and its libraries NumPy and matplotlib: which is the most used alternative. I think at this moment the community is a couple of orders of magnitude even bigger than MATLAB. Python is the de facto standard in machine learning and data science at the moment. But still, the syntax and memory concept is a bit far from what people are used to in the MATLAB ecosystem. There are also no equivalent to SIMULINK, although Spyder and Jupyter projects have come a long way in terms of the development environment.
Octave: is basically a clone of MATLAB to a point they consider any incompatibility as a bug. If you have a long MATLAB code that you don't want to touch, this is the safest bet. But again no alternative for SIMULINK.
SciLab and it's fork ScicoLab are the best alternatives in terms of GUI, having a SIMULINK replica xcos / scicos and a graphical user interface development features. However the community is not as big as Octave and the syntax is not completely compatible. Sadly the Scilab development team has gone through a devastating family crisis leading to the software falling behind.
Honorary mention of Modelica language implementations OpenModelica and jModelica for being a superior alternative to SIMULINK-SimScape. You should know that you can load Modelica scrips also in xcos and scicos. If you want to kno wmore about JModelica you may see this post.
you may check the MATLAB's Alternativeto page to see more Free and Open source alternatives.

Gaussian hypergeometric function 2F1

I would like to know if there is any available Gaussian hypergeometric function (2F1 function) code for Matlab.
I perfectly know that in the newest Matlab releases there is the hypergeom function, but it works really slow.
Therefore I was wondering about the existance of any mex function or whatever similar code performing what hypergeom does.
I thank you all in advance for support.
Best regards,
Francesco
The GNU Scientific Library implements hypergeometric functions including 2F1. You shouldn't have too much trouble wrapping that inside a mex-file.
I expect you'll find other sources knocking around on the Internet too.
Do report back and let us know if it does work faster than the intrinsic function.
After googleing a bit in the Internet, I came up with this tool provided within the Mathworks File Exchange:
http://www.mathworks.com/matlabcentral/fileexchange/35008-generation-of-random-variates/content/pfq.m
It consists of 1900 distributions, and among them the Gaussian hypergeometric function 2F1.
Furthermore, it has better performances than the standard hypergeom function.

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)