-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lmfit.minimize
with method='lbfgsb'
doesn't obey setting max_nfev
> 15000
#864
Comments
@rowlesmr Thanks. It looks like the scipy Currently, when you say
we actually convert that to
where But we are not also setting Line 967 in a03ac0f
to read
I'm not 100% sure that is the best place or way to do this: it is effectively applying a bandage to a confusing API, but that is sort of the story on FWIW, as a workaround that I would be hesitant to recommend as a viable long-term solution, you could do:
to set both of these. |
The paper for algorithm 778 says (somewhere in the middle)
Maybe that is the (at least the original) meaning between function evaluations and iterations. Iterations are when parameter values are updated and function evaluations takes into account the line search per iteration. I think you mean (from only using this package since yesterday) max_nfev to mean iterations. Maybe. |
@rowlesmr It would be sensible to guess that an iteration is between N_varys and 3*N_varys function calls (perhaps to first compute or update a derivative, then take a step, though maybe after the first step that is not needed .... ). But the documentation nor the paper (( think) are explicit and clear about that. And the code (in scipy.optimize, I have not looked at the Fortran in detail) sets a default value for both But, I think we can work around this wart in |
No worries. I'm in the middle of a calculation right now, so I'll probably be able to test tomorrow sometime. . Also just noticed that it looks like the message I'm getting corresponds to exceeding the maximum function evaluations, and not the maximum iterations. Anyhoo, I'll leave it to you; I tried to follow what you're doing, but got lost in the wrapping and indirection. Thanks for the package! |
First Time Issue Code
Yes, I read the instructions and I am sure this is a GitHub Issue.
Description
When minimising a residual using
lmfit.minimize
withmethod='lbfgsb'
, settingmax_nfev
to a value greater than the default value ofmaxiter
(15000) ofscipy.optimize.fmin_l_bfgs_b
results in the minimisation still terminating atnfev=15000
. Setting the keyword argumentmaxiter=50000
givesRuntimeWarning: ignoring 'maxiter' argument to 'Minimizer()'. Use 'max_nfev' instead.
.A Minimal, Complete, and Verifiable example
Error message:
Version information
Python: 3.9.4 (tags/v3.9.4:1f2e308, Apr 6 2021, 13:40:21) [MSC v.1928 64 bit (AMD64)]
lmfit: 1.2.0, scipy: 1.6.3, numpy: 1.21.4,asteval: 0.9.29, uncertainties: 3.1.7
Link(s)
#865
The text was updated successfully, but these errors were encountered: