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.
Describe the workflow you want to enable
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 (orsafe_sparse_dot) to convert if necessary.Describe your proposed solution
Allow
cscinscikit-learn/sklearn/decomposition/_truncated_svd.py
Line 215 in 557218c
Additional context
A PR with a benchmark result might be nice.