[Scipy-tickets] [SciPy] #641: number of function evaluation for leastsq

SciPy scipy-tickets@scipy....
Tue Apr 15 17:48:10 CDT 2008


#641: number of function evaluation for leastsq
-------------------------+--------------------------------------------------
 Reporter:  AchimGaedke  |       Owner:  somebody
     Type:  defect       |      Status:  new     
 Priority:  normal       |   Milestone:  0.7     
Component:  Other        |     Version:          
 Severity:  normal       |    Keywords:          
-------------------------+--------------------------------------------------
 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. First I thought, the parameter
 variation for gradient approximation is too tiny for a simple print
 command. Later I found out, that these three runs were independent of the
 number of fit parameters.

 A closer look to the code reveals the reason (svn dir
 trunk/scipy/optimize):

 1st call is to check with python code wether the function is valid

 line 265 of minpack.py
 {{{
 m = check_func(func,x0,args,n)[0]
 }}}


 2nd call is to get the right amount of memory for paramters.

 line 449 of _ _ minpack.h
 {{{
 ap_fvec = (PyArrayObject *)call_python_function(fcn, n, x, extra_args, 1,
 minpack_error);
 }}}


 3rd call is from inside the fortran algorithm (the essential one!)

 Unfortunately that behaviour is not described and I would eagerly demand
 to avoid the superficial calls to the function.

-- 
Ticket URL: <http://scipy.org/scipy/scipy/ticket/641>
SciPy <http://www.scipy.org/>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list