Use common convergence checks for lbfgs solver#14250
Use common convergence checks for lbfgs solver#14250agramfort merged 7 commits intoscikit-learn:masterfrom
Conversation
| Per default, the 'L-BFGS-B' algorithm from scipy.optimize.maximize | ||
| is used. If None is passed, the kernel's parameters are kept fixed. | ||
| Available internal optimizers are:: | ||
|
|
There was a problem hiding this comment.
Should we then deprecate fmin_l_bfgs_b as the input value in favor of L-BFGS-B, or lbfgs?
There was a problem hiding this comment.
Yes, I think that would be in order, and similarly I wanted to see if allowing other scipy optimizers in Gaussian processes would be interesting. Though I would rather do that in a follow-up PR, and keep this as a minimal refactoring not affecting backward compatibility.
There was a problem hiding this comment.
I agree allowing other optimizers would be a different PR, but since you're touching the docstring here, it makes sense for the accepted value to be the same or similar to what you mention in the docstring, I think.
But if you wanna do the deprecation in a different PR, I'm happy with that as well, and then this LGTM.
There was a problem hiding this comment.
I haven't changed the docstring value here only changed that the algorithm is called L-BFGS-B, not fmin_l_bfgs_b. That fix would apply even before this PR as fmin_l_bfgs_b is not an algorithm name it's the scipy function name for that optimizer.
Will do the deprecated in a follow up PR :) Thanks for the review!
adrinjalali
left a comment
There was a problem hiding this comment.
Thanks @rth, I really like PRs like this one.
|
thx heaps @rth |
First step toward #14248
This replaces to calls to
fmin_l_bfgs_bwithscipy.optimize.minimize(method="L-BFGS-B")and uses a common helper to check for convergence (for instance previously no warnings were shown in Gaussian process models). It also consistently applies the fix formax_iter,that was not done in neural_network module. Follow up on #9274 (review).
Although this PR is mostly an internal refactoring, it also fixes the above mentioned issues, and could be considered a bug fix.
The message in case of a
ConvergenceWarningis changed, so in that sense its somewhat non backward compatible change, but because the warning type is very specific I don't know how much that matters.Note:
fmin_l_bfgs_bis now marked as a legacy function in scipy,The mapping between legacy and new parameters for the optimization result can be found here