in dowhy/causal_identifier.py [0:0]
def __str__(self, only_target_estimand=False, show_all_backdoor_sets=False):
if self.no_directed_path:
s = "No directed path from {0} to {1} in the causal graph.".format(
self.treatment_variable,
self.outcome_variable)
s += "\nCausal effect is zero."
return s
s = "Estimand type: {0}\n".format(self.estimand_type)
i = 1
has_valid_backdoor = sum("backdoor" in key for key in self.estimands.keys())
for k, v in self.estimands.items():
if show_all_backdoor_sets:
# Do not show backdoor key unless it is the only backdoor set.
if k == "backdoor" and has_valid_backdoor > 1:
continue
else:
# Just show the default backdoor set
if k.startswith("backdoor") and k != "backdoor":
continue
if only_target_estimand and k != self.identifier_method:
continue
s += "\n### Estimand : {0}\n".format(i)
s += "Estimand name: {0}".format(k)
if k == self.default_backdoor_id:
s += " (Default)"
s += "\n"
if v is None:
s += "No such variable(s) found!\n"
else:
sp_expr_str = sp.pretty(v["estimand"], use_unicode=True)
s += "Estimand expression:\n{0}\n".format(sp_expr_str)
j = 1
for ass_name, ass_str in v["assumptions"].items():
s += "Estimand assumption {0}, {1}: {2}\n".format(j, ass_name, ass_str)
j += 1
i += 1
return s