[SciPy-User] lmfit-py -- simple least squares minimization

Ralf Gommers ralf.gommers@googlemail....
Sat Aug 27 06:59:47 CDT 2011


Hi Matt,

On Mon, Aug 15, 2011 at 3:05 PM, Matt Newville
<newville@cars.uchicago.edu>wrote:

> Hi,
>
> Having used on numpy and scipy for many years and being very pleased
> with them, I've found an area which I think might benefit from a
> modest improvement, and have tried to implement this.
>
> The scipy.optimize routines are robust, but seem a little unfriendly
> to people coming from proprietary environments or Numerical
> Recipes-level tools.   Specifically, the Levenberg-Marquardt algorithm
> is used heavily in many domains (including the x-ray spectroscopy
> fields I am most familiar with), but the MINPACK and
> scipy.optimize.leastsq implementation lack convenient ways to:
>      -  turn on/off parameters for fitting,  that is, to "fix"
> certain parameters.
>      -  place simple min/max bounds on parameters
>      -  place simple mathematical constraints on parameters.
>
> While these limitations can be worked around, doing so requires
> putting many options into the function to be minimized, which is
> somewhat inconvenient.    On the other hand, these features do exist
> in less robust fitting code that is not based on directly on MINPACK
> or as well-supported as scipy.
>
> I've written a module to do this so that the least-squares
> minimization from scipy.optimize.leastsq can take bounded and
> constrained parameters, and tried to make it of general use.    This
> code (BSD-licensed, somewhat documented) is at
>         http://github.com/newville/lmfit-py
>
> The constraint mechanism is a bit involved (using the ast module
> instead of 'eval'), but the rest of the code is quite straightforward
> and simple.   Currently, this supports minimization with
> scipy.optimize.leastsq, scipy.optimize.fmin_l_bfgs_b, and
> scipy.optimize.anneal. Supporting other algorithms could be possible.
>
> If you find this interesting or useful, I'd appreciate any feedback
> you might have.  For example, this is not currently organized as a
> scikit -- would that be preferable?
>
>
This will probably be useful to me at some point. Whether or not you
organize it as a scikit, it may be good to list your package at
http://scipy.org/Topical_Software.

Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20110827/73311e6c/attachment.html 


More information about the SciPy-User mailing list