[Scipy-tickets] [SciPy] #1542: fmin_bfgs gets stuck in an infinite loop when parameters are NaN
SciPy Trac
scipy-tickets@scipy....
Mon Oct 24 07:38:42 CDT 2011
#1542: fmin_bfgs gets stuck in an infinite loop when parameters are NaN
---------------------------------+------------------------------------------
Reporter: scipydevwikiaccount | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: Unscheduled
Component: scipy.optimize | Version: devel
Keywords: |
---------------------------------+------------------------------------------
I have a problem where scipy's fmin_bfgs function will get stuck in an
infite loop when one of the parameters is NaN. The reason this concerns me
is that for some reason, the fitter in my code is pushing parameters to be
NaN and then gets stuck in the loop.
Unfortunatly, I am unable to reproduce the more important issue of
parameters getting set to NaN, but having the code finish would be a step
in the right direction!
I do have a very simple example where scipy gets stuck in this infinite
loop when the starting value is NaN.
{{{
import numpy as np
from scipy import optimize
f=lambda x: x
x0 = [np.nan]
print 'fmin works',optimize.fmin(f, x0, disp=False, maxiter=10)
fp=lambda x: np.ones_like(x)
print 'fmin_bfgs gets stuck in a loop',optimize.fmin_bfgs(f, x0, fp,
disp=False, maxiter=10)
}}}
The reason this happens is that the functions line_search_wolfe1 and
line_search_wolfe2 have 'while 1' loops which never break when the fit
parmaeters are nan. So my suggested fix is to add an explicit check to
these functions that breaks in the case that these paramters are nan.
Thanks in advance,
--
Ticket URL: <http://projects.scipy.org/scipy/ticket/1542>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.
More information about the Scipy-tickets
mailing list