[SciPy-User] least squares producing different answers?

josef.pktd at gmail.com josef.pktd at gmail.com
Thu Jun 14 18:12:58 EDT 2012


On Thu, Jun 14, 2012 at 5:40 PM, Laura Matrajt <matrajt at 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.

Josef

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



More information about the SciPy-User mailing list