[SciPy-User] least squares producing different answers?

josef.pktd@gmai... josef.pktd@gmai...
Thu Jun 14 17:12:58 CDT 2012

On Thu, Jun 14, 2012 at 5:40 PM, Laura Matrajt <matrajt@gmail.com> wrote:
> Hi,
> I have an ODE with unknown parameters that I am trying to fit to data. In
> order to do this, I am trying to use scipy's least squares to evaluate
> different sets of parameters. Most of the time, this works fine, but I
> noticed  that sometimes I get different answers even though I am starting
> with the same initial guess.
> This makes sense to me if least squares uses something random in the
> algorithm, say at the very beginning to initialize the search.
> Otherwise, this might be a bug in my part. So, I have been searching for a
> bug for the last two days and I haven't found it.
> Does anyone have any idea if it is indeed the case that leastsq uses some
> type of random initialization?

the algorithm of optimize.leastsq is not (supposed to be) random, and
I don't think I've ever heard of random problems with it.

I guess it could be that there are some rounding, floating point
effects if the problem is not well behaved, like a singular jacobian,
but I only know of cases in linalg for that.


> Thank you in advance.
> --
> Laura
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user

More information about the SciPy-User mailing list