Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Minimal code sample (that we can run without your data, using public data)
adata_ref = sc.read(
f'./data/2717b0a0-948e-475b-87b2-818af9a68c9d.h5ad',
backup_url='https://datasets.cellxgene.cziscience.com/2717b0a0-948e-475b-87b2-818af9a68c9d.h5ad'
)
from cell2location.utils.filtering import filter_genes
selected = filter_genes(adata_ref, cell_count_cutoff=5, cell_percentage_cutoff2=0.03, nonz_mean_cutoff=1.12)
# filter the object
adata_ref = adata_ref[:, selected].copy()
cell2location.models.RegressionModel.setup_anndata(adata=adata_ref,
batch_key='donor_id',
labels_key='cell_type'
)
# create the regression model
from cell2location.models import RegressionModel
mod = RegressionModel(adata_ref)
# view anndata_setup as a sanity check
mod.view_anndata_setup()
mod.train(max_epochs=250, accelerator='gpu')
ValueError: Expected value argument (Tensor of shape (2500, 12666)) to be within the support (IntegerGreaterThan(lower_bound=0)) of the distribution GammaPoisson(), but found invalid values:
...
alpha_g_inverse dist | 1 12666
value | 1 12666
log_prob |
data_target dist 2500 12666 |
value 2500 12666 |
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Minimal code sample (that we can run without your data, using public data)