[SciPy-user] optimize.leastsq()

Francesc Alted falted at pytables.org
Fri Oct 22 07:00:22 CDT 2004

A Dijous 21 Octubre 2004 21:01, Travis Oliphant va escriure:
> Can you look at the output of peval(x,p) and compare it to y_true?
> I just re-ran this experiment and get
> array([-10.053690336957587,  33.659758123232756,   3.591816659730455)])
> which seems right (except for the fact that some of the phase has been 
> used to give -10 instead of 10).

Mmmm, I've re-run the example again and get
[-10.22083869,  34.03240033,   3.41523692]

so, I'm afraid that something weird happened in the run I've made yesterday.
Perhaps (I'm guessing here) the way to compute deviations, i.e.:

y_meas = y_true + 2*randn(len(x))

can give place to values too far from y_true and that can make the algorithm
to fail. It's a pity, but I dind't saved the values from my experiment
yesterday, so I can't reproduce the problem. 

Anyway, maybe it would be sensible to change the line where the computations
of deviations are made to read:

y_meas = y_true + randn(len(x))

although this may not be the cause, and it was just a human error :-/


Francesc Alted

More information about the SciPy-user mailing list