Skip to content

Commit

Permalink
svd on coo, lil and dok matrix is very slow
Browse files Browse the repository at this point in the history
  • Loading branch information
scottgigante committed Jun 12, 2018
1 parent 09ac70a commit bf194ce
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions graphtools/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ def _reduce_data(self):
if self.n_pca is not None and self.n_pca < self.data.shape[1]:
log_start("PCA")
if sparse.issparse(self.data):
if isinstance(self.data, sparse.coo_matrix) or \
isinstance(self.data, sparse.lil_matrix) or \
isinstance(self.data, sparse.dok_matrix):
self.data = self.data.tocsr()
self.data_pca = TruncatedSVD(self.n_pca,
random_state=self.random_state)
else:
Expand Down

0 comments on commit bf194ce

Please sign in to comment.