[SciPy-Dev] SciPy-Dev Digest, Vol 126, Issue 1

Matt Newville newville at cars.uchicago.edu
Tue Apr 1 14:11:33 EDT 2014


> Date: Tue, 1 Apr 2014 13:57:01 +0200
> From: Johann cohen-tanugi <johann.cohentanugi at gmail.com>
> Subject: Re: [SciPy-Dev] Levenberg-Marquardt Implementation
> To: SciPy Developers List <scipy-dev at scipy.org>
> Message-ID:
>         <CAJ_f96c6-U3r5QopnHeP_SkOrn1k-Vkt=ht=ifD3bPrF=Us6sw at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> FWIW I came across a python LM implementation of the minpack LM routine in
> https://code.google.com/p/astrolibpy/source/browse/mpfit/mpfit.py
> The license is GPLv3 though.
> Johann

The code (originally in IDL by Craig Markwardt at U Wisconsin and
available at http://www.physics.wisc.edu/~craigm/idl/) and the
translation into Python by Mark Rivers (with whom I work) shown in the
link you gave (and I could post separately) is actually not restricted
by GPLv3 and is under a more permissive BSD-like license:

 Translated from MINPACK-1 in FORTRAN, Apr-Jul 1998, CM
 Copyright (C) 1997-2002, Craig Markwardt
 This software is provided as is without any warranty whatsoever.
 Permission to use, copy, modify, and distribute modified or
 unmodified copies is granted, provided this copyright and disclaimer
 are included unchanged.

   Translated from MPFIT (Craig Markwardt's IDL package) to Python,
   August, 2002.  Mark Rivers

Astrolib.py may be distributing this under the GPLv3, but this code is
more permissively available.

Whether one wants to use this version (as opposed to the version in
scipy.optimize.leastsq) is another matter -- mpfit.py is in pure
python, and considerably slower than leastsq.   It might be worth
considering wrapping Markwardt's C version of MPFIT (which came after
the 2002 translation by Mark Rivers), but I have not looked into doing
this.

MPFIT does handle constraints to some extent (box constraints are
handled  tied values between parameters rare handled in a klunky way).
  Lmfit-py (which we're now using in place of MPFIT), uses a different
bounds implementations (that as described by MINUIT which makes
getting uncertainties for values near the boundaries more reliable)
and has a more flexible means for constraining parameter values to one
another.

I don't know of any implementation that handles "sparse Jacobians"
well.... I'm not sure I know of a problem that clearly fits that
category, though I can believe they exist.

--Matt Newville



More information about the SciPy-Dev mailing list