ENH Newton-CD part 5: add NewtonCDGramSolver for L1-penalized GLMs - #34377
Conversation
960dddf to
a2d10ec
Compare
39c75ac to
018cad9
Compare
018cad9 to
a7d0150
Compare
|
@OmarManzoor @virchan in the past, we 3 were quite a successful team. I hope this continues a little further. |
|
The PR looks amazing but because of the higher proportion of mathematics involved in the new solver it is a bit complicated to review. |
OmarManzoor
left a comment
There was a problem hiding this comment.
Thank you for the PR @lorentzenchr
virchan
left a comment
There was a problem hiding this comment.
Thank you for the PR, @lorentzenchr.
This is indeed a large one, so I'll need some time to go through it.
|
@OmarManzoor @virchan Take your time, no need to rush. I am so happy to have you both on board. |
OmarManzoor
left a comment
There was a problem hiding this comment.
Some further minor suggestions
OmarManzoor
left a comment
There was a problem hiding this comment.
A few more comments related to comments/docstrings otherwise this looks good now.
OmarManzoor
left a comment
There was a problem hiding this comment.
LGTM. Thank you for this amazing PR @lorentzenchr
virchan
left a comment
There was a problem hiding this comment.
LGTM! Let's merge this!
Thanks, everyone, for your time!
|
Oops, I just noticed that there is a merge conflict to resolve. Once that is fixed, this should be ready to merge! |
|
Merge conflict resolved and CI 🟢 |
Reference Issues/PRs
Part 5 of #33160.
What does this implement/fix? Explain your changes.
This PR implements the new GLM-solver class
NewtonCDGramSolver. It uses our coordinate-descent functionenet_coordinate_descent_gramunder the hood as inner solver.In this PR, the
solver="newton-cd-gram"is publicly exposed inLogisticRegressionandLogisticRegressionCV, but not yet (only privately) inPoissonRegressor,GammaRegressor,TweedieRegressor. The reason is that for the latter, a new parameterl1_rationeeds to be introduced. Not doing so keeps this PR a bit smaller.The tests are quite rigorous in my opinion and they pass.
The mechanics of a Newton Solver:
gand hessiansHCompute a Newton step
H @ step = -gThis solver uses coordinate descent.
AI usage disclosure
None
Any other comments?
This solver is good for
n_features << n_samples.