Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: How to use optimset for fminsearch to run Levenberg-Marquardt instead of Nelder-Mead?
Date: Thu, 29 Oct 2009 09:26:01 +0000 (UTC)
Organization: Link&#246;ping University
Lines: 27
Message-ID: <hcbn39$k4a$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1256808361 20618 172.30.248.38 (29 Oct 2009 09:26:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 29 Oct 2009 09:26:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1017447
Xref: news.mathworks.com comp.soft-sys.matlab:580880


Dear All,

I have searched the newsgroup for "fminsearch optimset" with combinations on "Levenberg-Marquardt" but I am still not finding what I am looking for. I hope you can help.

Question: I am suspecting that fminsearch cannot be changed to use any other optimization algorithm than Nelder-Mead and that my changes to the optimset argument are simply ignored. Is this true? If not, any suggestions on how I can change fminsearch to work with Levenberg-Marquardt? Alternatively, what other Matlab function would be appropriate for this task?

Application: I am trying to estimate a projection matrix and I want to use fminsearch to find the optimal parameters to minimize the reprojection error, i.e. the screen distance between some ground truth markers projected on the screen and some additional test markers also projected to the screen.

My code, using Matlab 7.3.0.298 (R2006b) on Ubuntu Dapper Drake, looks like this:

% Here I try to change the fminsearch's default optimiser from Nelder-Mead to Levenberg-Marquardt and also make it run for a little longer
options = optimset('MaxFunEvals', 10000, 'MaxIter', 10000);
options = optimset(options, 'LevenbergMarquardt, 'on');

% Here I call fminsearch with a function handle to the function that calculates an error, an array of parameter estimates that are to be changed such that the error returned by the function in the function handle is minimized. This error is reported back to errval, and I can also see if the optimizer terminated prematurely in flag. The output data structure also gives me further information.
[estimates errval flag output] = fminsearch(@psuedoHuberCostFunction, [rx ry rz tx ty tz fx fy px py], options); 

Observations:

1. The code as written here above runs, but the output.algorithm, which indicates which algorithm that was used, says that Nelder Mead was used.
2. If I change the call to optimset to any other string than 'LevenbergMarquardt', this results in an error. 

Motivation: I want to see if Levenberg-Marquardt with its adaptable step length can deal with a more complex parameter surface compared to Nelder-Mead and therefore is a better choice for camera calibrations with some alignment noise between correspondence points.

Thanks for your time and help.

Magnus