Skip to content

sklearn.decomposition.PCA svd_solver='auto' should default to "arpack" for sparse input  #7642

@nirizr

Description

@nirizr

I'm using sklearn version 0.18

When using sklearn.decomposition.PCA on a scipy.sparse, the value provided in the svd_solver parameter must be "arpack" (which is the only algorithm supporting sparse input).

the default svd_solver value, "auto" presumes to pick an appropriate default value depending on other input parameters (such as matrix shape and n_components).

It would be helpful if "auto" will also take sparsity into consideration.

Additionally, svd_solver value "full" (or "auto" that picks "full") yields the following error:

TypeError: A sparse matrix was passed, but dense data is required. Use X.toarray() to convert to a dense numpy array.

It would be helpful if the error included a suggestion to use svd_solver value of "arpack" as a potential fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationEasyWell-defined and straightforward way to resolve

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions