[SciPy-User] fmin_bfgs stuck in infinite loop
Tue Oct 25 06:43:28 CDT 2011
I created a pull request at https://github.com/scipy/scipy/pull/96
Maybe we should move the discussion there.
On 10/25/2011 01:30 PM, email@example.com wrote:
> On Tue, Oct 25, 2011 at 5:46 AM, Pauli Virtanen<firstname.lastname@example.org> wrote:
>> 24.10.2011 19:50, Johann Cohen-Tanugi kirjoitti:
>>> while 1:
>>> stp, phi1, derphi1, task = minpack2.dcsrch(alpha1, phi1, derphi1,
>>> c1, c2, xtol, task,
>>> amin, amax, isave, dsave)
>>> if task[:2] == asbytes('FG') and not np.isnan(phi1):
>>> alpha1 = stp
>>> phi1 = phi(stp)
>>> derphi1 = derphi(stp)
>> Looks correct to me. It should bail out from the loop on encountering
>> a nan, as in that case it's unlikely it's possible to satisfy the wolfe
> Is there an explanation for task? What does task[:2] == 'FG' mean?
> I tried the condition separately.
> if np.isnan(phi1) or np.isneginf(phi1):
> if task[:2] == asbytes('FG'):
> I also added the isneginf check, because I think there is also the
> possibility of an infinite loop at phi = -inf.
> I would still feel safer if there is a maxiter in the line search, as
> in the python version, scalar_search_wolfe2
> a separate issue:
> bfgs does not have an xtol, which means we don't get any indication if
> only one or some of the parameters go to inf.
> But I don't have a nice example yet. This case can show up for example
> in Logit estimation. In a variation of the example in this ticket, the
> optimized parameters when one parameter goes to inf and the others to
> a finite number looks sometimes pretty bad.
>> Pauli Virtanen
>> SciPy-User mailing list
> SciPy-User mailing list
More information about the SciPy-User