[SciPy-User] leastsq returns bizarre, not fitted, output for float values

Charles R Harris charlesr.harris@gmail....
Thu Jun 10 10:56:48 CDT 2010


On Thu, Jun 10, 2010 at 9:35 AM, <josef.pktd@gmail.com> wrote:

> On Thu, Jun 10, 2010 at 11:15 AM, Charles R Harris
> <charlesr.harris@gmail.com> wrote:
> >
> >
> > On Thu, Jun 10, 2010 at 8:10 AM, Charles R Harris
> > <charlesr.harris@gmail.com> wrote:
> >>
> >>
> >> On Thu, Jun 10, 2010 at 8:02 AM, Matthieu Rigal <rigal@rapideye.de>
> wrote:
> >>>
> >>> OK, I've found the bug...
> >>>
> >>> Somehow the leastsq function is not working if both data sets are float
> >>> 32
> >>> type.
> >>> By just adding following line the problem is solved :
> >>> aX = numpy.asarray(aX, dtype=numpy.float64)
> >>>
> >>> Is it a known bug ? Should I add it to the bug tracker ?
> >>>
> >>> Best regards,
> >>> Matthieu
> >>>
> >>
> >> I think you should open a ticket and include a simple example.
> >>
> >
> > I also note that the documentation of leastsq is totally screwed up and
> the
> > covariance returned is not the covariance, nor is it the currently
> > documented Jacobian.
>
> cov_x is the raw covariance, what's wrong with the explanation
>
> I never figured out how to get the Jacobian directly, and am not sure
> about the details of the jacobian calculation
>
>
In this case the Jacobian is a numerical derivative, essentially the
Jacobian in the Gauss-Newton method, and available in its economical qr with
column pivoting factored form. What is returned as the covariance is
(J^T*J)^{-1} and needs to be multiplied by the variance of the error, either
estimated from the residuals or known apriori, in order to get an estimate
of the covariance.  Things missing from the documentation: signature of the
function to be optimized and "at a glance" documentation of what is returned
and what returns are optional.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100610/ef0aa44f/attachment.html 


More information about the SciPy-User mailing list