Skip to content

Commit

Permalink
removed deepiv and updated flaky test
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Sharma <amit_sharma@live.com>
  • Loading branch information
amit-sharma committed Dec 1, 2023
1 parent 9ebf9e3 commit 9258cbb
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1,471 deletions.
1,511 changes: 53 additions & 1,458 deletions docs/source/example_notebooks/dowhy-conditional-treatment-effects.ipynb

Large diffs are not rendered by default.

20 changes: 7 additions & 13 deletions tests/causal_estimators/test_econml_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def test_backdoor_estimators(self):
)
# Checking that the CATE estimates are not identical
dml_cate_estimates_f = dml_estimate.cate_estimates.flatten()
assert pytest.approx(dml_cate_estimates_f[0], 0.01) != dml_cate_estimates_f[1]
assert pytest.approx(dml_cate_estimates_f[0], 0.001) != dml_cate_estimates_f[1]
# Test ContinuousTreatmentOrthoForest
orthoforest_estimate = model.estimate_effect(
identified_estimand,
Expand All @@ -71,7 +71,7 @@ def test_backdoor_estimators(self):
)
# Checking that the CATE estimates are not identical
orthoforest_cate_estimates_f = orthoforest_estimate.cate_estimates.flatten()
assert pytest.approx(orthoforest_cate_estimates_f[0], 0.01) != orthoforest_cate_estimates_f[1]
assert pytest.approx(orthoforest_cate_estimates_f[0], 0.001) != orthoforest_cate_estimates_f[1]

# Test LinearDRLearner
data_binary = datasets.linear_dataset(
Expand Down Expand Up @@ -102,7 +102,7 @@ def test_backdoor_estimators(self):
},
)
drlearner_cate_estimates_f = drlearner_estimate.cate_estimates.flatten()
assert pytest.approx(drlearner_cate_estimates_f[0], 0.01) != drlearner_cate_estimates_f[1]
assert pytest.approx(drlearner_cate_estimates_f[0], 0.001) != drlearner_cate_estimates_f[1]

def test_metalearners(self):
data = datasets.linear_dataset(
Expand Down Expand Up @@ -190,21 +190,15 @@ def test_iv_estimators(self):
keras.layers.Dense(1),
]
)
deepiv_estimate = model.estimate_effect(
dmliv_estimate = model.estimate_effect(
identified_estimand,
method_name="iv.econml.iv.nnet.DeepIV",
method_name="iv.econml.iv.dml.DMLIV",
target_units=lambda df: df["X0"] > -1,
confidence_intervals=False,
method_params={
"init_params": {
"n_components": 10, # Number of gaussians in the mixture density networks
# Treatment model,
"m": lambda z, x: treatment_model(keras.layers.concatenate([z, x])),
# Response model
"h": lambda t, x: response_model(keras.layers.concatenate([t, x])),
"n_samples": 1, # Number of samples used to estimate the response
"first_stage_options": {"epochs": 25},
"second_stage_options": {"epochs": 25},
'discrete_treatment':False,
'discrete_instrument':False
},
"fit_params": {},
},
Expand Down

0 comments on commit 9258cbb

Please sign in to comment.