[SciPy-user] fmin_bfgs optimizer hangs?

Nils Wagner nwagner at iam.uni-stuttgart.de
Mon Nov 6 03:31:10 EST 2006


Marek Wojciechowski wrote:
>> Try to start with fmin_powell and switch to fmin_bfgs.
>> Please let me know if that works for your problem.
>>
>> I have observed several scenarios e.g. convergence towards local
>> extrema, oscillating behaviour (fmin_ncg) , ...
>>
>> Sometimes I get a message
>> Warning: Desired error not necessarily achieved due to precision loss
>>
>>     
>
> It seems that the problem of fmin_bfgs is just there is no parameter
> for maximum calls of function. Together with possible oscilating behavior
> there are the cases the routine never ends... Maybe this should be
> considered as a bug?. Using fmin_powell before does not make things
> better.
> Till now I found fmin_l_bfgs_b and fmin_tnc, constrained optimizers,
> useful for me. I can safely set max number of function calls and, if I'm
> not satisfied with the result, restart from another starting point.
>
> Greetings
>
>   
Help on function fmin_bfgs

 fmin_bfgs(f, x0, fprime=None, args=(), gtol=1.0000000000000001e-05,
norm=inf, epsilon=1.49011611938e-08, maxiter=None, full_output=
0, disp=1, retall=0, callback=None)

    Additional Inputs:

      maxiter -- the maximum number of iterations.
      full_output -- if non-zero then return fopt, func_calls, grad_calls,
                     and warnflag in addition to xopt.
      disp -- print convergence message if non-zero.
      retall -- return a list of results at each iteration if non-zero

You can specify the maximum number of iterations.

Nils




More information about the SciPy-User mailing list