-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Improve TruncatedSVD.transform on sparse csc matrices #16828
Copy link
Copy link
Closed
Labels
EasyWell-defined and straightforward way to resolveWell-defined and straightforward way to resolveNew Featuregood first issueEasy with clear instructions to resolveEasy with clear instructions to resolvehelp wantedmodule:decomposition
Description
Describe the workflow you want to enable
import scipy.sparse as ss
from sklearn.decomposition import TruncatedSVD
X = ss.random(1000, 100, format='csc')
tsvd = TruncatedSVD().fit(X)
tsvd.transform(X)
Currently, in the last line, transform(X) will first convert X from csc to csr and then apply a dot product. I think this conversion is unnecessary, costs additional time, and one should better rely on scipy.sparse (or safe_sparse_dot) to convert if necessary.
Describe your proposed solution
Allow csc in
| X = check_array(X, accept_sparse='csr') |
Additional context
A PR with a benchmark result might be nice.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
EasyWell-defined and straightforward way to resolveWell-defined and straightforward way to resolveNew Featuregood first issueEasy with clear instructions to resolveEasy with clear instructions to resolvehelp wantedmodule:decomposition