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

Adam Ginsburg adam.ginsburg at colorado.edu
Fri May 1 20:19:58 EDT 2009


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?

Thanks,
Adam



More information about the SciPy-User mailing list