Skip to content

Problem with ridgeCV: centering the design matrix messes the solution when n < p #1807

Closed

Description

@bthirion

Centering the design matrix cancels one of its singular values when n < p. This creates a numeric mess in the RidgeCV computation.
An example of the bad behaviour is given in:
https://gist.github.com/bthirion/5233416

I'm still not fully sure about the right solution. Comments welcome !
Best.

Activity

  1. mblondel commented on Mar 25, 2013

    @mblondel
    Member

    Thanks for the report! Any idea how to fix this?

  2. agramfort commented on Jul 25, 2013

    @agramfort
    Member

    i looked into it:

    https://gist.github.com/agramfort/6078557

    you'll see that if X is rank deficient even your code @bthirion fails to find the good alpha.

    I think both implementations match. So the questions is how to fix these 10 lines of code
    to it works with a rank deficient X....

  3. bthirion commented on Jul 25, 2013

    @bthirion
    MemberAuthor

    On 25/07/2013 14:53, Alexandre Gramfort wrote:

    i looked into it:

    https://gist.github.com/agramfort/6078557

    you'll see that if X is rank deficient even your code @bthirion
    https://github.com/bthirion fails to find the good alpha.

    Yes for sure.

    I think both implementations match. So the questions is how to fix
    these 10 lines of code
    to it works with a rank deficient X....

    I wanted to look at it, but haven't found time for that, sorry.
    See you,

    B

    —
    Reply to this email directly or view it on GitHub
    #1807 (comment).

  4. added this to the 0.15.1 milestone on Jul 18, 2014
  5. modified the milestones: 0.16, 0.17 on Sep 11, 2015
  6. modified the milestones: 0.17, 0.18 on Nov 2, 2015
  7. bthirion commented on Jan 3, 2016

    @bthirion
    MemberAuthor

    Getting back to that one: see https://gist.github.com/bthirion/834b78c274e7f411665d
    What sklearn's gcv computes is actually the mse, BUT in a setting (fit_intercept=False, pre-centered data), that gives trivial and misleading results as soon as n_features >= n_samples - 1

    My suggestion is to change this to make the gcv results equivalent to a setting where fit_intercept=True.
    Any opinion ?

  8. agramfort commented on Jan 3, 2016

    @agramfort
    Member
  9. modified the milestones: 0.18, 0.19 on Sep 22, 2016
  10. jnothman commented on Jun 14, 2017

    @jnothman
    Member

    Fixed in #6178, afaik

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions