[SciPy-User] Least-squares fittings with bounds: why is scipy not up to the task?

Pauli Virtanen pav@iki...
Thu Mar 8 18:00:12 CST 2012

08.03.2012 21:29, Eric Emsellem kirjoitti:
> What I didn't find in Scipy (or numpy or..) is *an efficient 
> least-squares fitting routine which can include bounded, or fixed 
> parameters*. This seems like something many people must be needing! I am 
> right now using mpfit.py (from minpack then Craig B. Markwardt for idl 
> and Mark Rivers for python), which I did integrate in the package I am 
> developing.

mpfit is a Fortran-to-Python translation of a MINPACK routine. Scipy's
leastsq uses the original MINPACK Fortran code, so it's probably more
efficient than mpfit.py. However, the bounded parameters seems to be a
more recent addition that are not in the original.

The good news is that mpfit license seems at first sight compatible with
Scipy's. There's also an existing pull request for reimplementation of
Levenberg-Marquardt which might also work as a base for further work,
although IIRC it didn't implement bound limits. The only thing missing
is someone who needs this stuff and is not averse for a little bit of
dirty work, combining the existing pieces and making sure that the API
makes sense.

Pauli Virtanen

More information about the SciPy-User mailing list