[Scipy-tickets] [SciPy] #1150: fmin_ncg test sometimes not converging

SciPy Trac scipy-tickets@scipy....
Thu Apr 8 10:09:31 CDT 2010

#1150: fmin_ncg test sometimes not converging
 Reporter:  rgommers        |       Owner:  somebody
     Type:  defect          |      Status:  new     
 Priority:  normal          |   Milestone:  0.8.0   
Component:  scipy.optimize  |     Version:  devel   
 Keywords:                  |  
 The test for optimize.fmin_ncg sometimes fails to converge. It is not very
 reproducible though.

 ERROR: line-search Newton conjugate gradient optimization routine
 Traceback (most recent call last):
   File "c:\Python26\lib\site-
 packages\scipy\optimize\tests\test_optimize.py", line 113, in test_ncg
   File "c:\Python26\lib\site-packages\scipy\optimize\optimize.py", line
 1088, in fmin_ncg
     alphak, fc, gc, old_fval = line_search_BFGS(f,xk,pk,gfk,old_fval)
   File "c:\Python26\lib\site-packages\scipy\optimize\optimize.py", line
 591, in line_search_BFGS
     phi_a2 = f(*((xk+alpha2*pk,)+args))
   File "c:\Python26\lib\site-packages\scipy\optimize\optimize.py", line
 97, in function_wrapper
     return function(x, *args)
   File "c:\Python26\lib\site-
 packages\scipy\optimize\tests\test_optimize.py", line 39, in func
     raise RuntimeError, "too many iterations in optimization routine"
 RuntimeError: too many iterations in optimization routine

 It has been observed with 0.7.2rc1 on Vista and 0.8dev on XP.

 It has also been reported that running tests through scipy.test() is fine

   nosetests test_optimize.py

 produces an error. Josef reports:

 I put a print statement into the function of the test and sometimes
 the arguments turn into nans, and in this case the optimization breaks
 down. I have no idea why this happens sometimes but not always, or why
 there should be an random element to the result.

 I think the default epsilon is too small for practical purposes, but
 that's a different issue, and the test seems to work correctly in
 general. However, I never get a failure with larger epsilon.

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

More information about the Scipy-tickets mailing list