Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self._outcome,
common_cause_names=self._common_causes,
instrument_names=self._instruments,
effect_modifier_names = self._effect_modifiers,
observed_node_names=self._data.columns.tolist()
)
elif common_causes is not None:
self._graph = CausalGraph(
self._treatment,
self._outcome,
common_cause_names=self._common_causes,
effect_modifier_names = self._effect_modifiers,
observed_node_names=self._data.columns.tolist()
)
elif instruments is not None:
self._graph = CausalGraph(
self._treatment,
self._outcome,
instrument_names=self._instruments,
effect_modifier_names = self._effect_modifiers,
observed_node_names=self._data.columns.tolist()
)
else:
cli.query_yes_no(
"WARN: Are you sure that there are no common causes of treatment and outcome?",
default=None
)
else:
self._graph = CausalGraph(
self._treatment,
self._outcome,
self._missing_nodes_as_confounders = missing_nodes_as_confounders
if 'logging_level' in kwargs:
logging.basicConfig(level=kwargs['logging_level'])
else:
logging.basicConfig(level=logging.INFO)
# TODO: move the logging level argument to a json file. Tue 20 Feb 2018 06:56:27 PM DST
self.logger = logging.getLogger(__name__)
if graph is None:
self.logger.warning("Causal Graph not provided. DoWhy will construct a graph based on data inputs.")
self._common_causes = parse_state(common_causes)
self._instruments = parse_state(instruments)
self._effect_modifiers = parse_state(effect_modifiers)
if common_causes is not None and instruments is not None:
self._graph = CausalGraph(
self._treatment,
self._outcome,
common_cause_names=self._common_causes,
instrument_names=self._instruments,
effect_modifier_names = self._effect_modifiers,
observed_node_names=self._data.columns.tolist()
)
elif common_causes is not None:
self._graph = CausalGraph(
self._treatment,
self._outcome,
common_cause_names=self._common_causes,
effect_modifier_names = self._effect_modifiers,
observed_node_names=self._data.columns.tolist()
)
elif instruments is not None:
elif instruments is not None:
self._graph = CausalGraph(
self._treatment,
self._outcome,
instrument_names=self._instruments,
effect_modifier_names = self._effect_modifiers,
observed_node_names=self._data.columns.tolist()
)
else:
cli.query_yes_no(
"WARN: Are you sure that there are no common causes of treatment and outcome?",
default=None
)
else:
self._graph = CausalGraph(
self._treatment,
self._outcome,
graph,
observed_node_names=self._data.columns.tolist(),
missing_nodes_as_confounders = self._missing_nodes_as_confounders
)
self._common_causes = self._graph.get_common_causes(self._treatment, self._outcome)
self._instruments = self._graph.get_instruments(self._treatment,
self._outcome)
self._effect_modifiers = self._graph.get_effect_modifiers(self._treatment, self._outcome)
self._other_variables = kwargs
self.summary()
if graph is None:
self.logger.warning("Causal Graph not provided. DoWhy will construct a graph based on data inputs.")
self._common_causes = parse_state(common_causes)
self._instruments = parse_state(instruments)
self._effect_modifiers = parse_state(effect_modifiers)
if common_causes is not None and instruments is not None:
self._graph = CausalGraph(
self._treatment,
self._outcome,
common_cause_names=self._common_causes,
instrument_names=self._instruments,
effect_modifier_names = self._effect_modifiers,
observed_node_names=self._data.columns.tolist()
)
elif common_causes is not None:
self._graph = CausalGraph(
self._treatment,
self._outcome,
common_cause_names=self._common_causes,
effect_modifier_names = self._effect_modifiers,
observed_node_names=self._data.columns.tolist()
)
elif instruments is not None:
self._graph = CausalGraph(
self._treatment,
self._outcome,
instrument_names=self._instruments,
effect_modifier_names = self._effect_modifiers,
observed_node_names=self._data.columns.tolist()
)
else:
cli.query_yes_no(