Skip to content Skip to sidebar Skip to footer

Scikit-learn (sklearn) Pca Throws Type Error On Sparse Matrix

From the documentation of sklearn RandomizedPCA, sparse matrices are accepted as input. However when I called it with a sparse matrix, I got a TypeError : > sklearn.__version__

Solution 1:

The answer is that it is not possible to have RandomizedPCA work with a sparse matrix with version 0.16.1 of Scikit-learn (current stable version). The documentation I was referring to was for a previous version of Scikit-learn and so alternative functions should be used for the current stable version.

A possible alternative is TruncatedSVD

Post a Comment for "Scikit-learn (sklearn) Pca Throws Type Error On Sparse Matrix"