Error calling CasualForestDML.dowhy.fit()
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 4.8k
- Forks
- 827
- PR merge metrics
- No merged PRs in 30d
Description
Wanting to use the DoWhy module during the fit call so I can do refutation later. Getting the following error. Can you help? For context, this is being run inside Databricks in conjunction with MLFlow. EconML version 0.11.1. DoWhy version 0.6.
TypeError Traceback (most recent call last)
<command-1717976837619280> in <module>
7 with mlflow.start_run(run_name=run_name) as run:
8
----> 9 causal_forest.dowhy.fit(y, t, X=x, W=w)
10
11 # log model params
/local_disk0/pythonVirtualEnvDirs/virtualEnv-cea1c30c-4db1-4650-a59d-8736863da592/lib/python3.7/site-packages/econml/dowhy.py in fit(self, Y, T, X, W, Z, outcome_names, treatment_names, feature_names, confounder_names, instrument_names, graph, estimand_type, proceed_when_unidentifiable, missing_nodes_as_confounders, control_value, treatment_value, target_units, **kwargs)
158 missing_nodes_as_confounders=missing_nodes_as_confounders
159 )
--> 160 self.identified_estimand_ = self.dowhy_.identify_effect(proceed_when_unidentifiable=True)
161 method_name = "backdoor." + self._cate_estimator.__module__ + "." + self._cate_estimator.__class__.__name__
162 init_params = {}
/local_disk0/pythonVirtualEnvDirs/virtualEnv-cea1c30c-4db1-4650-a59d-8736863da592/lib/python3.7/site-packages/dowhy/causal_model.py in identify_effect(self, estimand_type, method_name, proceed_when_unidentifiable)
137 method_name,
138 proceed_when_unidentifiable=proceed_when_unidentifiable)
--> 139 identified_estimand = self.identifier.identify_effect()
140
141 return identified_estimand
/local_disk0/pythonVirtualEnvDirs/virtualEnv-cea1c30c-4db1-4650-a59d-8736863da592/lib/python3.7/site-packages/dowhy/causal_identifier.py in identify_effect(self)
46 """
47 if self.estimand_type == CausalIdentifier.NONPARAMETRIC_ATE:
---> 48 return self.identify_ate_effect()
49 elif self.estimand_type == CausalIdentifier.NONPARAMETRIC_NDE:
50 return self.identify_nde_effect()
/local_disk0/pythonVirtualEnvDirs/virtualEnv-cea1c30c-4db1-4650-a59d-8736863da592/lib/python3.7/site-packages/dowhy/causal_identifier.py in identify_ate_effect(self)
68 self.outcome_name,
69 backdoor_sets,
---> 70 estimands_dict)
71 # Setting default "backdoor" identification adjustment set
72 default_backdoor_id = self.get_default_backdoor_set_id(backdoor_variables_dict)
/local_disk0/pythonVirtualEnvDirs/virtualEnv-cea1c30c-4db1-4650-a59d-8736863da592/lib/python3.7/site-packages/dowhy/causal_identifier.py in build_backdoor_estimands_dict(self, treatment_name, outcome_name, backdoor_sets, estimands_dict, proceed_when_unidentifiable)
335 backdoor_estimand_expr = self.construct_backdoor_estimand(
336 self.estimand_type, treatment_name,
--> 337 outcome_name, backdoor_sets_arr[i])
338 self.logger.debug("Identified expression = " + str(backdoor_estimand_expr))
339 estimands_dict["backdoor"+str(i+1)] = backdoor_estimand_expr
/local_disk0/pythonVirtualEnvDirs/virtualEnv-cea1c30c-4db1-4650-a59d-8736863da592/lib/python3.7/site-packages/dowhy/causal_identifier.py in construct_backdoor_estimand(self, estimand_type, treatment_name, outcome_name, common_causes)
437 num_expr_str = outcome_name
438 if len(common_causes)>0:
--> 439 num_expr_str += "|" + ",".join(common_causes)
440 expr = "d(" + num_expr_str + ")/d" + ",".join(treatment_name)
441 sym_mu = sp.Symbol("mu")
TypeError: sequence item 0: expected str instance, int found
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at CasualForestDML.dowhy.fit and follow the traceback into dowhy_.identify_effect(), especially causal_identifier.py's construct_backdoor_estimand. Reproduce with EconML 0.11.1, DoWhy 0.6, and the Databricks/MLFlow context described; done means the fit call completes without the reported TypeError and permits later refutation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100