-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
Allow LogisticRegression with lbfgs solver to control maxfun
parameter of solver
#27484
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
Comments
starting to work on this features |
please share me the closest piece of code to your problem statement |
@lorentzenchr @ogrisel I assume that it would make sense to be able to control these low-level parameters sometimes. I am bit skeptical to add yet another parameter because it will be solver dependent. However, it could be handy to have a generic parameter to pass additional parameters, that could specific to the underlying solver. Do you have any thoughts on this? |
Could we please first merge #26721 (needs a 2nd reviewer) and then see if we still need control over |
@lorentzenchr I'll review today. |
@vascosmota Could you provide a minimal example? |
I am working on creating a minimal example, but it is proving harder than expected. I will update as soon as I have one. |
+1 for this as I stumbled over a case where I need to set a higher |
The question is a bit: Should we add a |
Just started fixing this myself. Design-wise, I would opt for passing an optimizer to The option that aligns most with the code that already exists is to just add a |
Taking the design work done by the |
Example fixes:
(I've ignored making the same changes to |
Describe the workflow you want to enable
Similarly to what is mentioned on #9273
training a LogisticRegression regressor using l-bfgs currently cannot perform more than (approx) 15000 function evaluations.
This artificial limit is caused by the call site to l-bfgs passing the
LogisticRegression
argument valuemax_iters
to the argument formaxiter
(maximum number of iterations), but not formaxfun
(maximum number of function evaluations), so that no matter how large a number you pass as "max_iters" to train for LogisticRegression, the function evaluations are capped by the default value for maxiter (15000, defined on https://github.com/scipy/scipy/blob/bf776169c753fff655200dc15ae26db95a083b02/scipy/optimize/_lbfgsb_py.py#L212).Describe your proposed solution
When calling the l-bfgs solver, set
maxfun
to be the same asmaxiter
, allow the user to control it.As stated on #9274 by @daniel-perry,
The same rational could be used here.
Describe alternatives you've considered, if relevant
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: