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

Charles R Harris charlesr.harris@gmail....
Wed Apr 28 12:34:38 CDT 2010

```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?

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100428/cba9b603/attachment.html
```