py-why / dowhy

DoWhy is a Python library for causal inference that supports explicit modeling and testing of causal assumptions. DoWhy is based on a unified language for causal inference, combining causal graphical models and potential outcomes frameworks.
https://www.pywhy.org/dowhy
MIT License
7.12k stars 934 forks source link

How can i get a deterministic output/estimate? #556

Open zahs123 opened 2 years ago

zahs123 commented 2 years ago

Hi,

I am running dowhy using the following:


causal_graph = """digraph {

}"""

#print(df_dowhy)
model = dowhy.CausalModel(data=df_dowhy,
                     graph=causal_graph.replace("\n", " "),
                     treatment="if_use_drug",
                     outcome="outcomel")
model.view_model()
from IPython.display import Image, display
display(Image(filename="causal_model.png"))

estimate = model.estimate_effect(identified_estimand, 
                                 method_name='backdoor.propensity_score_matching',
                                target_units="att")
print(estimate)

NOTE: i have removed the causal model but above is the main skeleton. Every time i run the above for same dataset i get a different estimate.. is there a seed i can set?

Where is the randomness coming from.

Thank you

amit-sharma commented 2 years ago

This is related to #418. Working on a fix.