Message Boards Message Boards

3
|
5896 Views
|
1 Reply
|
4 Total Likes
View groups...
Share
Share this post:

Get FindMinimum to increase step size when necessary?

Posted 7 years ago

(Cross-posted from Mathematica.SE.)

I wish to share some observations concerning current limitations (bugs?) of Mathematica's "LevenbergMarquardt" algorithm of FindMinimum which (as I hope) can help to improve it.

I've spent much time finding a minimal example demonstrating this problem. Normally one faces it when fitting very large and complicated functions, but the attached Notebook contains a simplified example which allows reproducing it. The essence of the problem seems to be that FindMinimum doesn't increase step size when it should. The outcome is a ridiculously slow minimization process where FindMinimum takes so little steps in the direction of the minimum that it virtually never achieves it. But with a simple workaround it is possible to get FindMinimum coming to the minimum in a few steps.

In the section "Demonstration of the problem" I give several numbered code samples. The case number 1 is an attempt to fit with the default settings. At first glance it works well because we get the desired minimum in 220 steps what is a good result, but look at the second case: simple multiplication of the residual vector by 10 allows obtaining the same much faster, in 51 steps! This is already suspicious because the correct implementation of the Levenberg-Marquardt algorithm shouldn't depend on the scale of residuals, at least in such extent. The third case emphasizes this: simple division of the residual vector by 2 makes it impossible to obtain the minimum with default MaxIterations, and we have to increase the latter, because now the minimization process requires 1005 steps!

The four code sample demonstrates a workaround: restricting MaxIterations to 100 and running the minimization again with starting values set to the minimum obtained after 100 iterations allows achieving the true minimum in 120 steps in total even when the residual vector is divided by 20.

This workaround demonstrates that it is undoubtedly possible to improve current algorithm of FindMinimum, and with relatively little effort. I also hope that it will help to fix the bug causing FindMinimum to depend on the scale of the residuals in such large extent.

Reported to support as [CASE:3967239].

Attachments:
POSTED BY: Alexey Popkov
Posted 2 years ago

I just rerun the Notebook attached to the original post with Mathematica 13.0.0. The behavior is the same: the number is steps required to find the minimum strongly depends on the scale of the residual vector: dividing the latter by 2 (!) results in 984 steps instead of 220 steps with the original vector, multiplying it by 10 decreases the number of steps to 51. Splitting minimization in two calls to FindMinimum reduces the number of steps to 120. Evaluation time is also nearly the same as with version 8.0.4 installed on the same machine.

No response from the Wolfram Team so far. It seems that the basic implementation does not have changed since version 8.

POSTED BY: Alexey Popkov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract