Skip to content

The reproducibility of cell deconvolution #18

@cby01

Description

@cby01

Hello, I've set the seed code as shown below before executing the Spoint.init_model, spoint.train, and spoint.deconv_spatial() functions in my Python script. However, after repeatedly running the script, I noticed that the deconvolution results aren't entirely consistent, with around 20% of the cells differing in identity. How can I resolve this reproducibility issue with the deconvolution?

====================================

import random
import numpy as np
random.seed(42)
np.random.seed(42)
torch.manual_seed(42)
torch.cuda.manual_seed(42)
torch.cuda.manual_seed_all(42)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False

====================================

spoint = Spoint.init_model(sc_ad, st_ad, celltype_key=f"{celltype_index}",sm_size=200000, n_threads=20, use_gpu=use_gpu)
spoint.train(max_steps=10000, batch_size=1024,early_stop=True)
pre = spoint.deconv_spatial()
st_ad = spoint.st_ad
st_ad.write(f"Spiont_{sample_id}.h5ad")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions