Skip to content

FIX/API Fix AIC/BIC in LassoLarsIC and introduce noise_variance #21481

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

Merged
merged 39 commits into from
Nov 23, 2021

Conversation

glemaitre
Copy link
Member

@glemaitre glemaitre commented Oct 27, 2021

closes #14566
closes #17145

This solves the way we compute the AIC and BIC. We are using the formulation from:
https://www.sciencedirect.com/science/article/abs/pii/S0893965917301623

Basically, it seems equivalent to Zou et al. at a multiplicative factor (and with correction for the bug reported in #17145 due to the estimation of the noise variance).

We reproduce the example from Zou et al. and diabetes.

@glemaitre
Copy link
Member Author

ping @agramfort

@glemaitre glemaitre changed the title FIX compute the AIC and BIC using MSE FIX/API Fix AIC/BIC in LassoLarsIC and introduce noise_variance Oct 30, 2021
Copy link
Member

@agramfort agramfort left a comment

Choose a reason for hiding this comment

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

thx @glemaitre !

glemaitre and others added 3 commits October 30, 2021 22:05
Co-authored-by: Alexandre Gramfort <alexandre.gramfort@m4x.org>
Co-authored-by: Alexandre Gramfort <alexandre.gramfort@m4x.org>
Copy link
Member

@agramfort agramfort left a comment

Choose a reason for hiding this comment

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

just one last.

Co-authored-by: Alexandre Gramfort <alexandre.gramfort@m4x.org>
Copy link
Member

@agramfort agramfort left a comment

Choose a reason for hiding this comment

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

good to go from my end. Someone else wants to have a look? maybe @lorentzenchr @rth @ogrisel ?

thx @glemaitre !

Copy link
Member

@lorentzenchr lorentzenchr left a comment

Choose a reason for hiding this comment

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

A first very partial review.

Comment on lines 365 to 368
is the predicted target using an ordinary least squares regression. In
scikit-learn, we use a ridge model with a very small regularization in case
of ill-conditioned design matrix. Note, that this formula is valid only when
`n_samples > n_features`.
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure, using Ridge is fine? Could you test that for one case?
https://arxiv.org/pdf/0712.0881.pdf Theorem 1 states that results are valid only if X is full rank (dummy vs one-hot encoding).

Copy link
Member Author

Choose a reason for hiding this comment

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

The safeguard to use an OLS is to check the rank of the matrix before computing the dof then?

Copy link
Member

Choose a reason for hiding this comment

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

Let's try with plain LinearRegression. The coef will be numerically unstable but the estimated variance based on its in-sample predictions should be fine.

We just need to make sure to include tests in with n_samples ~= n_features and many collinear features to check that either the results are ok without error messages or that the error messages (if any) make sense.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not saying that ridge is false. I'm just asking as the papers do not mention it and use plain OLS. I've no intuition if it's fine in this context.

glemaitre and others added 4 commits November 2, 2021 13:29
Co-authored-by: Christian Lorentzen <lorentzen.ch@gmail.com>
Copy link
Member

@lorentzenchr lorentzenchr left a comment

Choose a reason for hiding this comment

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

LGTM when all comments are addressed.
Thanks @glemaitre. This is a good improvement!

Co-authored-by: Christian Lorentzen <lorentzen.ch@gmail.com>
@glemaitre
Copy link
Member Author

Apparently I don't know how to merge main anymore in a PR :)

@glemaitre
Copy link
Member Author

Sorry for the "force-pushed"

@glemaitre
Copy link
Member Author

I think that this is fine now. I will just check the rendering of the example to be sure that the table is fitting now.

@glemaitre glemaitre removed the cython label Nov 22, 2021
@glemaitre
Copy link
Member Author

The rendering seems OK on my side. @lorentzenchr do you want to have a look at the changes regarding the summary to see if this is fine with you?

Copy link
Member

@lorentzenchr lorentzenchr left a comment

Choose a reason for hiding this comment

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

LGTM. Some more nitpicks.

glemaitre and others added 2 commits November 22, 2021 15:36
Co-authored-by: Christian Lorentzen <lorentzen.ch@gmail.com>
Copy link
Member

@jjerphan jjerphan left a comment

Choose a reason for hiding this comment

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

LGTM, thank you @glemaitre!

Here are some suggestions.

glemaitre and others added 2 commits November 23, 2021 11:09
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
@glemaitre
Copy link
Member Author

glemaitre commented Nov 23, 2021 via email

Copy link
Member

@lorentzenchr lorentzenchr left a comment

Choose a reason for hiding this comment

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

Last comment...

Co-authored-by: Christian Lorentzen <lorentzen.ch@gmail.com>
@lorentzenchr
Copy link
Member

And over the finish line ... as soon as CI is green.

@lorentzenchr
Copy link
Member

@glemaitre Thanks for your patience with reviewers!:wink:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in LASSO AIC BIC formula LassoLarsIC information criteria incorrectly calculated
5 participants