[SciPy-user] number of function evaluation for leastsq

Stéfan van der Walt stefan at sun.ac.za
Tue Apr 15 16:11:37 EDT 2008


Hi Achim

On 15/04/2008, Achim Gaedke <Achim.Gaedke at physik.tu-darmstadt.de> wrote:
> Hello!
>
>  I use scipy.optimize.leastsq to adopt paramters of a model to measured
>  data. Each evaluation of that model costs 1.5 h of computation time.
>  Unfortunately I can not specify a gradient function.
>
>  While observing the approximation process I found that the first 3 runs
>  were always with the same parameters.

Woops, that should be fixed, if possible.  In the meantime, you can
use the memoize decorator as a workaround:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/466320

Your function calls take so long that you really won't notice the
(tiny) overhead.

Regards
Stéfan



More information about the SciPy-User mailing list