[SciPy-User] fmin_bfgs stuck in infinite loop

Johann Cohen-Tanugi johann.cohen-tanugi@lupm.univ-montp2...
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.
J

On 10/25/2011 01:30 PM, josef.pktd@gmail.com wrote:
> On Tue, Oct 25, 2011 at 5:46 AM, Pauli Virtanen<pav@iki.fi>  wrote:
>> 24.10.2011 19:50, Johann Cohen-Tanugi kirjoitti:
>> [clip]
>>>      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)
>>>          else:
>>>              break
>> 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
>> conditions.
> 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):
>              break
>          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.
>
> Thanks,
>
> Josef
>
>
>> --
>> Pauli Virtanen
>>
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>


More information about the SciPy-User mailing list