lmcinnes / umap

Uniform Manifold Approximation and Projection
BSD 3-Clause "New" or "Revised" License
7.46k stars 809 forks source link

scipy.sparse._csparsetools.lil_get_lengths Error Running UMAP #1078

Open ghost opened 11 months ago

ghost commented 11 months ago

Chunk of code:

``

# 2 UMAP
plot_kwds = {'alpha': 0.3, 's': 0.2, 'linewidths': 0}
UMAP_kwds = {'n_neighbors': 30, 'min_dist': 0.1, 'n_components': 2, 'random_state': SEED}

mapper = UMAP(random_state=42,verbose = True).fit(matrix)
#X_r = Umap(matrix, UMAP_kwds, plot_kwds)

`` Even with a one liner it doesn't work

mapper = UMAP(random_state=42,verbose = True).fit(matrix)

I've tried downgrading scipy to various versions but still unable to make it work. My output:

UMAP(random_state=42,` verbose=True)
 Construct fuzzy simplicial set
 Thu Dec 14 12:55:37 2023 Finding Nearest Neighbors
 Thu Dec 14 12:55:37 2023 Building RP forest with 25 trees
 Thu Dec 14 12:55:57 2023 NN descent for 17 iterations
     0  /  17
     1  /  17
     2  /  17
     3  /  17
     4  /  17
     5  /  17
Thu Dec 14 12:56:49 2023 Finished Nearest Neighbor Search
Traceback (most recent call last):
  File "***\Umap_deepseqprot.py", line 138, in <module>
    results = Main(files)
  File "***\Umap_deepseqprot.py", line 105, in Main
    mapper = UMAP(random_state=42,verbose = True).fit(matrix)
  File "***\venv\lib\site-packages\umap\umap_.py", line 1452, in fit
    self._search_graph.transpose()
  File "***\venv\lib\site-packages\scipy\sparse\lil.py", line 437, in transpose
    return self.tocsr(copy=copy).transpose(axes=axes, copy=False).tolil(copy=False)
  File "***\venv\lib\site-packages\scipy\sparse\lil.py", line 468, in tocsr
    _csparsetools.lil_get_lengths(self.rows, lengths)
  File "_csparsetools.pyx", line 109, in scipy.sparse._csparsetools.lil_get_lengths
ValueError: Buffer has wrong number of dimensions (expected 1, got 2)

Process finished with exit code 1