scverse / scanpy

Single-cell analysis in Python. Scales to >1M cells.
https://scanpy.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.89k stars 594 forks source link

A umap warning #3139

Closed fengchuiguo1994 closed 3 months ago

fengchuiguo1994 commented 3 months ago

Please make sure these conditions are met

What happened?

When I do umap analysis, I got a warning. I try to change the maxiter parameter, but it doesn't work.

Minimal code sample

sc.tl.umap(adata, maxiter=50)

Error output

computing UMAP
/data/home/ruanlab/huangxingyu/miniconda3/lib/python3.10/site-packages/umap/spectral.py:342: UserWarning: Exited at iteration 20 with accuracies 
[0.01180801 0.01616286 0.01491355]
not reaching the requested tolerance 1e-08.
Use iteration 19 instead with accuracy 
0.013873452618210833.

  eigenvalues, eigenvectors = scipy.sparse.linalg.lobpcg(
/data/home/ruanlab/huangxingyu/miniconda3/lib/python3.10/site-packages/umap/spectral.py:342: UserWarning: Exited postprocessing with accuracies 
[0.0114102  0.01466    0.01555016]
not reaching the requested tolerance 1e-08.
  eigenvalues, eigenvectors = scipy.sparse.linalg.lobpcg(
    finished: added
    'X_umap', UMAP coordinates (adata.obsm) (1:07:21)

Versions

``` ----- anndata 0.9.1 scanpy 1.10.1 ----- Cython 0.29.33 IPython 8.13.2 PIL 9.4.0 annoy NA asttokens NA backcall 0.2.0 bbknn 1.6.0 brotli NA certifi 2022.12.07 cffi 1.15.1 charset_normalizer 2.0.4 cycler 0.10.0 cython 0.29.33 cython_runtime NA dateutil 2.8.2 decorator 5.1.1 executing 1.2.0 fontTools 4.39.0 h5py 3.8.0 idna 3.4 igraph 0.10.5 jedi 0.18.2 joblib 1.3.1 kiwisolver 1.4.4 lazy_loader 0.4 legacy_api_wrap NA llvmlite 0.40.1 matplotlib 3.9.0 matplotlib_inline 0.1.6 mpl_toolkits NA natsort 8.4.0 numba 0.57.1 numexpr 2.8.4 numpy 1.23.0 packaging 23.0 pandas 2.0.1 parso 0.8.3 patsy 0.5.6 pexpect 4.8.0 pickleshare 0.7.5 pkg_resources NA platformdirs 3.8.0 plotly 5.13.1 pooch v1.7.0 prompt_toolkit 3.0.38 psutil 5.9.5 ptyprocess 0.7.0 pure_eval 0.2.2 pyarrow 12.0.1 pycparser 2.21 pygments 2.14.0 pynndescent 0.5.10 pyparsing 3.0.9 pytz 2023.3 requests 2.28.1 ruamel NA scipy 1.10.1 seaborn 0.13.2 session_info 1.0.0 six 1.16.0 skimage 0.24.0 sklearn 1.3.0 socks 1.7.1 sphinxcontrib NA stack_data 0.6.2 statsmodels 0.14.2 texttable 1.6.7 threadpoolctl 3.1.0 tqdm 4.64.1 traitlets 5.9.0 typing_extensions NA umap 0.5.3 urllib3 1.26.14 wcwidth 0.2.6 yaml 6.0 zstandard 0.18.0 ----- Python 3.10.9 (main, Jan 11 2023, 15:21:40) [GCC 11.2.0] Linux-3.10.0-957.el7.x86_64-x86_64-with-glibc2.17 ----- Session information updated at 2024-07-03 12:41 ```
flying-sheep commented 3 months ago

Umap currently (0.5.4) suppresses that warning, so I guess it’s ok: https://github.com/lmcinnes/umap/blame/master/umap/spectral.py#L532-L536

that was fixed in https://github.com/lmcinnes/umap/pull/1031

You probably just need to upgrade umap to 0.5.4 to no longer see that.