Skip to content

ENH Newton-CD part 7: add NewtonCDSolver - #34561

Merged
virchan merged 9 commits into
scikit-learn:mainfrom
lorentzenchr:logistic_lasso_newton_part_7
Aug 7, 2026
Merged

virchan merged 9 commits into
scikit-learn:mainfrom
lorentzenchr:logistic_lasso_newton_part_7

Conversation

@lorentzenchr

@lorentzenchr lorentzenchr commented Jul 24, 2026 •

Copy link
Copy Markdown
Member

Reference Issues/PRs

Part 7 of #33160, follow-up of #34377 and #34523.

What does this implement/fix? Explain your changes.

This PR implements the new GLM-solver class NewtonCDSolver which is much like NewtonCDGramSolver of #34377. It uses our coordinate-descent functions without the "gram" matrix as inner solver.

The solver="newton-cd" is then publicly exposed in LogisticRegression, LogisticRegressionCV, PoissonRegressor, GammaRegressor, TweedieRegressor.

The multinomial/multiclass (n_classes >= 3) case is not yet implemented because existing (in literature and packages) algorithms do not converge for simple test cases. See the extensive code comment. There are follow-ups to close this gap.

AI usage disclosure

I used AI assistance for:

  • Finding bugs

Any other comments?

This solver is good for n_features > n_samples.

@virchan

virchan commented Jul 25, 2026 •

Copy link
Copy Markdown
Member

CI is still failing after resolving conflicts in e68688a. Investigating.

@virchan

virchan commented Jul 25, 2026

Copy link
Copy Markdown
Member

CI looks better now. I will review it later.

@OmarManzoor OmarManzoor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you @lorentzenchr

There is an error in relation to the change log

@lorentzenchr

Copy link
Copy Markdown
Member Author

The changelog renders fine, so I set the "no changelog needed" label.

@OmarManzoor OmarManzoor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I used Gemini Pro to analyze just the NewtonCDSolver class and I am sharing some points which I think are valid.

@OmarManzoor OmarManzoor added the Waiting for Second Reviewer First reviewer is done, need a second one! label Jul 31, 2026

@OmarManzoor OmarManzoor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two questions.

Comment thread sklearn/linear_model/_logistic.py Resolved
Comment thread sklearn/linear_model/_logistic.py Resolved

@virchan virchan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR looks good to me.

One question: should we do something about the codecov warning?

I'd be more comfortable merging once CI is all green, but if this is going to be addressed in the follow-up PR, I'm also fine with merging this as is.

@lorentzenchr

Copy link
Copy Markdown
Member Author

One question: should we do something about the codecov warning?

I would prefer not to. It will work out, part 8 can follow.

@virchan

virchan commented Aug 7, 2026

Copy link
Copy Markdown
Member

I would prefer not to. It will work out, part 8 can follow.

Ok. Let's merge this!

@virchan
virchan merged commit c74a434 into scikit-learn:main Aug 7, 2026
32 of 33 checks passed
@lorentzenchr
lorentzenchr deleted the logistic_lasso_newton_part_7 branch August 7, 2026 17:33
prady0t pushed a commit to prady0t/scikit-learn that referenced this pull request Sep 2, 2026
@jeremiedbb jeremiedbb mentioned this pull request Sep 8, 2026
14 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants