Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow set random seed for reproducibility in CompositionalAnalysis objects #49

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yihming
Copy link

@yihming yihming commented Mar 3, 2022

Usage

In sccoda.util.comp_ana.CompositionalAnalysis, add seed optional parameter:

  • If not specifying a value, it behaves as normal.
  • If specifying a value as the following:
from sccoda.util import comp_ana as mod
...
model_salm = mod.CompositionalAnalysis(data_salm, formula="Condition", reference_cell_type="Goblet", seed=0) 

This code reproduces the same result in different execution times.

@johannesostner
Copy link
Collaborator

Hi, thanks for this pull request!
I am unsure though, whether this change is necessary. As far as I know, it is also possible to get consistent results by running

tf.random.set_seed(0)
model_salm = mod.CompositionalAnalysis(data_salm, formula="Condition", reference_cell_type="Goblet")

Are you aware of any situations where this strategy could fail to produce reproducible results?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants