[SciPy-User] Optimize.Leastsq Issues

Suraj Mirpuri mirpurisuraj1 at gmail.com
Fri Aug 9 03:03:25 EDT 2013


Hello All,

I think I've been having some difficulty with optimize.leastsq the past few
hours because for the life of me I cannot seem to get it to work.
Specifically, my issue is that when I use it without a Jacobian function it
estimates a Jacobian of all 0's, and when I give it a real Jacobian and use
full_output = 1 it also returns all 0's. However this cannot be the case as
at least at the initial point that I feed in, the Jacobian is definitely
non zero. It just ends up giving me the initial parameters each time.

I am not quite sure I have it set up right so I have attached a paste bin
link to my code if anyone could take a look at it, and the output of
leastsq is at the end of it. Also it's been sort of cobbled together late
at night so I recognize it's not exactly efficient code, I just need to get
it working I guess.

Also I tried both col_deriv=1 and 0 with appropriate return value in
grad_func as I found a thread that suggests this makes a difference. I
couldn't see that it did.

Code:

http://pastebin.com/qa3gw1AD

Thanks in advance!

-- Raj Mirpuri
Research Assistant
Roberts Group
Caltech
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20130809/40a675e1/attachment.html>


More information about the SciPy-User mailing list