WillianFuks / tfcausalimpact

Python Causal Impact Implementation Based on Google's R Package. Built using TensorFlow Probability.
Apache License 2.0
610 stars 72 forks source link

How to set seed within the sampling process? #90

Open jxie-im opened 6 months ago

jxie-im commented 6 months ago

I am wondering if anyone can help point to the places where we can set seed?

Thanks!

WillianFuks commented 5 months ago

Hi @jxie-im ,

I can't test it now but does the following work?

seed = 24
os.environ['TF_DETERMINISTIC_OPS'] = 'true'
os.environ['PYTHONHASHSEED'] = f'{seed}'
np.random.seed(seed)
random.seed(seed)
tf.random.set_seed(seed)