theislab / scCODA

A Bayesian model for compositional single-cell data analysis
BSD 3-Clause "New" or "Revised" License
147 stars 24 forks source link

Importance of warnings/errors in model_scelltype_Time.sample_hmc() output #54

Closed Lopiniatre closed 1 year ago

Lopiniatre commented 2 years ago

Hi scCODA team and thank you for making this nice tool available. I am running into warnings when running model_scelltype_Time.sample_hmc() apparently involving beta_nonzero_mean.append() and ret.dtype.type(). The function still generate an output with meaningful results. As I'm not an expert in Python, I wanted to know if this warning can be ignored or not and what kind of error was involved (a setup, implementation or input design issue?). Does it affect the reliability of the output? Here is what I got as an output (I'm using the singularity image to run scCODA): `

model_scelltype_Time = mod.CompositionalAnalysis(data_sccelltype, formula="stage + clone", reference_cell_type="automatic") Automatic reference selection! Reference cell type set to IPC/nN 2022-05-30 14:55:56.605202: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /opt/R/lib/R/lib::/.singularity.d/libs 2022-05-30 14:55:56.605258: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303) 2022-05-30 14:55:56.605300: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (c18n01.ruddle.hpc.yale.internal): /proc/driver/nvidia/version does not exist 2022-05-30 14:55:56.607509: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. Zero counts encountered in data! Added a pseudocount of 0.5. simres_celltype_Time = model_scelltype_Time.sample_hmc() WARNING:tensorflow:@custom_gradient grad_fn has 'variables' in signature, but no ResourceVariables were used on the forward pass. WARNING:tensorflow:@custom_gradient grad_fn has 'variables' in signature, but no ResourceVariables were used on the forward pass. 2022-05-30 14:56:32.299744: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:185] None of the MLIR Optimization Passes are enabled (registered 2) 0%| | 0/20000 [00:00<?, ?it/s] 2022-05-30 14:56:33.121718: I tensorflow/compiler/xla/service/service.cc:171] XLA service 0x2b066c011710 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2022-05-30 14:56:33.121764: I tensorflow/compiler/xla/service/service.cc:179] StreamExecutor device (0): Host, Default Version 2022-05-30 14:56:33.223335: I tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.cc:210] disabling MLIR crash reproducer, set env var MLIR_CRASH_REPRODUCER_DIRECTORY to enable. 2022-05-30 14:56:34.553831: I tensorflow/compiler/jit/xla_compilation_cache.cc:363] Compiled cluster using XLA! This line is logged at most once for the lifetime of the process. 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20000/20000 [02:26<00:00, 136.38it/s] MCMC sampling finished. (186.700 sec) Acceptance rate: 80.6% /opt/python/lib/python3.8/site-packages/sccoda/util/result_classes.py:252: RuntimeWarning: Mean of empty slice. beta_nonzero_mean.append(beta_i_raw[beta_i_raw_nonzero].mean()) /opt/python/lib/python3.8/site-packages/numpy/core/_methods.py:170: RuntimeWarning: invalid value encountered in double_scalars ret = ret.dtype.type(ret / rcount)`

Another question was the importance of the Acceptance rate %? Is it an important output? how can it be interpreted and below which value is it problematic? Thank you for your help!

johannesostner commented 2 years ago

Hi @Lopiniatre! We are aware of all these warnings, and they should not affect the results. A quick breakdown: