8000 fit_intercept in RidgeCV with sparse design matrix and gcv_mode='svd' · Issue #13325 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content
fit_intercept in RidgeCV with sparse design matrix and gcv_mode='svd' #13325
Closed
@jeromedockes

Description

@jeromedockes

Currently the ridge with generalized cross-validation which uses an SVD of the
design matrix (the best when there are more samples than features) does not
support sparse design matrices.

this results in silently using an eigendecomposition of the Gram matrix when
gcv_mode is 'auto'

if sparse.issparse(X) or n_features > n_samples or with_sw:

or raising an error when the user explicitly asked for svd

raise TypeError("SVD not supported for sparse matrices")

would it be better to:

  • allow sparse design matrices and compute the SVD using scipy.sparse.linalg.LinearOperator

  • warn the user that 'eigen' is being used, which can be very inefficient when
    n_samples is much larger than n_features, so that they can decide if it is
    better to use 'eigen', cast X to a dense matrix, or turn to another mode of CV
    than the generalized CV

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0