Skip to content

Commit 299b1d7

Browse files
authored
Remove DeepIV econml estimator from notebook and fix flaky test (#1091)
* removed deepiv and updated flaky test Signed-off-by: Amit Sharma <amit_sharma@live.com> * black reformattingb Signed-off-by: Amit Sharma <amit_sharma@live.com> * removed all outputs from nb Signed-off-by: Amit Sharma <amit_sharma@live.com> --------- Signed-off-by: Amit Sharma <amit_sharma@live.com>
1 parent 2900fd7 commit 299b1d7

File tree

2 files changed

+59
-1473
lines changed

2 files changed

+59
-1473
lines changed

docs/source/example_notebooks/dowhy-conditional-treatment-effects.ipynb

Lines changed: 53 additions & 1458 deletions
Large diffs are not rendered by default.

tests/causal_estimators/test_econml_estimator.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def test_backdoor_estimators(self):
6161
)
6262
# Checking that the CATE estimates are not identical
6363
dml_cate_estimates_f = dml_estimate.cate_estimates.flatten()
64-
assert pytest.approx(dml_cate_estimates_f[0], 0.01) != dml_cate_estimates_f[1]
64+
assert pytest.approx(dml_cate_estimates_f[0], 0.001) != dml_cate_estimates_f[1]
6565
# Test ContinuousTreatmentOrthoForest
6666
orthoforest_estimate = model.estimate_effect(
6767
identified_estimand,
@@ -71,7 +71,7 @@ def test_backdoor_estimators(self):
7171
)
7272
# Checking that the CATE estimates are not identical
7373
orthoforest_cate_estimates_f = orthoforest_estimate.cate_estimates.flatten()
74-
assert pytest.approx(orthoforest_cate_estimates_f[0], 0.01) != orthoforest_cate_estimates_f[1]
74+
assert pytest.approx(orthoforest_cate_estimates_f[0], 0.001) != orthoforest_cate_estimates_f[1]
7575

7676
# Test LinearDRLearner
7777
data_binary = datasets.linear_dataset(
@@ -102,7 +102,7 @@ def test_backdoor_estimators(self):
102102
},
103103
)
104104
drlearner_cate_estimates_f = drlearner_estimate.cate_estimates.flatten()
105-
assert pytest.approx(drlearner_cate_estimates_f[0], 0.01) != drlearner_cate_estimates_f[1]
105+
assert pytest.approx(drlearner_cate_estimates_f[0], 0.001) != drlearner_cate_estimates_f[1]
106106

107107
def test_metalearners(self):
108108
data = datasets.linear_dataset(
@@ -190,22 +190,13 @@ def test_iv_estimators(self):
190190
keras.layers.Dense(1),
191191
]
192192
)
193-
deepiv_estimate = model.estimate_effect(
193+
dmliv_estimate = model.estimate_effect(
194194
identified_estimand,
195-
method_name="iv.econml.iv.nnet.DeepIV",
195+
method_name="iv.econml.iv.dml.DMLIV",
196196
target_units=lambda df: df["X0"] > -1,
197197
confidence_intervals=False,
198198
method_params={
199-
"init_params": {
200-
"n_components": 10, # Number of gaussians in the mixture density networks
201-
# Treatment model,
202-
"m": lambda z, x: treatment_model(keras.layers.concatenate([z, x])),
203-
# Response model
204-
"h": lambda t, x: response_model(keras.layers.concatenate([t, x])),
205-
"n_samples": 1, # Number of samples used to estimate the response
206-
"first_stage_options": {"epochs": 25},
207-
"second_stage_options": {"epochs": 25},
208-
},
199+
"init_params": {"discrete_treatment": False, "discrete_instrument": False},
209200
"fit_params": {},
210201
},
211202
)

0 commit comments

Comments
 (0)