-
-
Notifications
You must be signed in to change notification settings - Fork 26.5k
ENH/FIX: make coordinate descent solver converge for ridge regression #32845
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
base: main
Are you sure you want to change the base?
Conversation
|
@OmarManzoor @virchan @ogrisel you might be interested |
|
As teaser: I need this for a larger surprise PR... |
| assert se_ols <= 1e-20 | ||
| assert se_enet <= 1e-20 | ||
| else: | ||
| assert se_enet <= se_ols <= 1e-20 # Who would have thought that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this quite surprising.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use assert_allclose here, since we want to check that ElasticNet(alpha=0.0) converges to Ridge? Also, I'm curious. --- what surprised you, aside from floating-point effects?
virchan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks, @lorentzenchr!
I just have a few questions for my own understanding.
| # This is Ridge regression, we use formulation B for the dual gap. | ||
| gap = R_norm2 + 0.5 * beta * w_l2_norm2 - Ry | ||
| gap += 1 / (2 * beta) * dual_norm_XtA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that this is an implementation detail. However, would it be useful to include this mathematical detail in the user guide, given that Formulation A is already covered?
| assert se_ols <= 1e-20 | ||
| assert se_enet <= 1e-20 | ||
| else: | ||
| assert se_enet <= se_ols <= 1e-20 # Who would have thought that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use assert_allclose here, since we want to check that ElasticNet(alpha=0.0) converges to Ridge? Also, I'm curious. --- what surprised you, aside from floating-point effects?
Reference Issues/PRs
Warnings for
alpha=0/l1_ratio=0where introduced in #620. A note that Enet with dual gap as stopping criterion does not converge was mentioned in #19620 (comment).What does this implement/fix? Explain your changes.
This PR makes the coordinate descent solver of
LassoandElasticNetetc. converge for Ridge regression.Details
What prevents the CD solver in the main branch is that the dual gap is not valid for
alpha=0/l1_ratio=0. Fortunately, there is an alternative dual gap available, see #22836.Any other comments?
There are some surprising results, see the new
test_enet_ols_consistency.