-
Notifications
You must be signed in to change notification settings - Fork 34
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
ENH - add support for intercept in SqrtLasso
#214
base: main
Are you sure you want to change the base?
ENH - add support for intercept in SqrtLasso
#214
Conversation
SqrtLasso
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.
Thanks @PascalCarrivain for the PR!
Here are some remarks
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.
@Badr-MOUFAD merge if happy!
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.
Many thanks @PascalCarrivain for the hard work 💪
Just a small bit before merging
We didn't add tests for the intercept (we might be vulnerable to bugs later)
I'm not aware of any package to check against it the new feature, any suggestions @mathurinm?
With that being said, we can leverage the equivalence between the problem with intercept and without as the datafit is a norm_2 hence setting its gradient w.r.t. the intercept to zero implies setting the residual to zero
if sqrt_lasso.fit_intercept: | ||
np.testing.assert_equal(sqrt_lasso.coef_[:-1], 0) | ||
else: | ||
np.testing.assert_equal(sqrt_lasso.coef_, 0) |
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.
WDYT about this refactoring?
if sqrt_lasso.fit_intercept: | |
np.testing.assert_equal(sqrt_lasso.coef_[:-1], 0) | |
else: | |
np.testing.assert_equal(sqrt_lasso.coef_, 0) | |
np.testing.assert_equal(sqrt_lasso.coef_[:n_features], 0) |
Context of the PR
This PR adds support for intercept in
SqrtLasso
estimator.Closes #96
Checks before merging PR