[SciPy-user] Constrained least-squares fitting routine?

Sebastian Haase haase@msg.ucsf....
Sat May 2 09:45:35 CDT 2009

On Sat, May 2, 2009 at 2:19 AM, Adam Ginsburg
<adam.ginsburg@colorado.edu> wrote:
> Hi Scipy group,
>   Is there a constrained least squares fitting routine available, or
> can anyone offer me tips on implementing such a beast?  I have been
> using scipy.optimize.leastsq, but I do not know how to constrain
> parameters.  The model I'm looking to emulate is Craig Markwardt's
> mpfit.pro (http://www.physics.wisc.edu/~craigm/idl/down/mpfit.pro), in
> particular the parinfo section that allows max/min and fixed
> parameters.  I've tried simply constraining parameters in my fitting
> function using if statements to set min/max values, but this strategy
> fails, I think because the algorithm pushes into space outside of the
> limits and can't get back.
>     I don't think the constrained fitting tools, e.g. fmin_cobyla,
> are what I'm looking for, but I can't be certain I understand them.
> Are they likely/likelier to get stuck in local minima than the
> Levenberg-Marquardt algorithm used in leastsq?

how about cobyla - that is part of scipy and ready to go ...

Sebastian Haase

More information about the SciPy-user mailing list