-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
FIX correct Lasso.dual_gap_ to match the objective in its docstring #19172
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
Conversation
I would (edit) not change the Cython code. AFAIU, that part is correct. I would change
and correct the dual gap after calling the solver from cd_fast . (And add a comment why we need to rescale.)
|
Thanks @lorentzenchr. I'm guessing you mean "I would NOT change" the cython code ? Indeed the gap there matches the cython formulation. |
I think |
thanks, fixed. I'm missing something : |
@mathurinm Can you add a test for the correct dual gap? |
|
I added a test where I compute manually the gap after fitting, and check that it equals |
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
Co-authored-by: Christian Lorentzen <lorentzen.ch@gmail.com>
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 !
do we need a what's new entry?
Yes, a short bugfix note is a good idea. |
…into scale_dgap_lasso
@mathurinm Thank you very much for detecting and fixing this bug. |
Reference Issues/PRs
closes #19160
What does this implement/fix? Explain your changes.
The Lasso objective in the docstring is 1 / n_samples * the objective minimized in the cython solvers. The duality gap returned by the solvers should therefore be scaled so that after fitting, Lasso.dual_gap_ corresponds to the formulation with 1/n_samples.
Importantly, this does not affect the optimization process: the stopping criterion is untouched, and the same number of iterations are run.