[SciPy-User] [solved] ODR , Levenberg-Marquardt, non linear fitting and convergence: some assistance needed

ms devicerandom@gmail....
Thu Apr 29 07:23:58 CDT 2010

On 28/04/10 18:44, Robert Kern wrote:
> On Wed, Apr 28, 2010 at 12:34, Charles R Harris
> <charlesr.harris@gmail.com>  wrote:
>> On Wed, Apr 28, 2010 at 10:10 AM,<josef.pktd@gmail.com>  wrote:
>>> On Mon, Apr 26, 2010 at 1:09 PM, ms<devicerandom@gmail.com>  wrote:
>>>> Hi,
>>>> I am currently smashing my head on the following problem.
>>>> I am trying to fit data to two equations, which are two levels of
>>>> approximation for the same model. I am currently using ODR to fit.
>>>> Of course the 2nd order approximation is mathematically bit more
>>>> complicated than the first, involving a long summatory etc. but the
>>>> resulting curve and behaviour are overall very similar.
>>>> Now, in my tests, the 1st order approx. usually converges, while the 2nd
>>>> order does not converge at all: not that it gives some wrong result, it
>>>> remains stuck to the initial parameters with zero values in the
>>>> covariance, etc. This even when I feed to ODR starting values very close
>>>> to the "true" ones.
>>>> I used fmin so far to bypass this problem, but it is really slow.
>>>> Recently a collegue of mine told me that he can get Levenberg-Marquardt
>>>> to minimize the untreatable (in my system) 2nd order approx, using
>>>> Mathematica, out of the box.
>>>> I have no idea unfortunately what are the differences between the
>>>> Mathematica and the ODRPACK implementations of Levenberg-Marquardt, but
>>>> if one can do it I think the other one can too. So, what should I try to
>>>> improve my system? I tried increasing iterations, fixing X values etc.
>>>> but nothing seems to work properly. Do you have any hint?
>>> scipy.optimize.leastsq , and
>> I use leastsq a lot and like it. It comes from MINPACK, I didn't know there
>> was a version of Levenberg-Marquardt available in ODRPACK. Is there?
> No. ODRPACK uses a trust-region algorithm instead of
> Levenberg-Marquardt. They are conceptually similar, though.

Thank you for your feedback. I used leastsq and it works well, even if 
it's definitely slower than the ODR -but at least now I'm reassured I 
was not doing anything wrong.

I thought ODR was using LM too -thanks for the information!


More information about the SciPy-User mailing list