Skip to content

Commit

Permalink
black reformattingb
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 9258cbb commit a31c688
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,21 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 53,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Refute: Add a random common cause\n",
"Estimated effect:14.994627967720675\n",
"New effect:14.945141670381393\n",
"p value:0.34\n",
"\n"
]
}
],
"source": [
"res_random=model.refute_estimate(identified_estimand, dml_estimate, method_name=\"random_common_cause\")\n",
"print(res_random)"
Expand All @@ -459,9 +471,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 54,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Refute: Add an Unobserved Common Cause\n",
"Estimated effect:14.994627967720675\n",
"New effect:14.932381066137944\n",
"\n"
]
}
],
"source": [
"res_unobserved=model.refute_estimate(identified_estimand, dml_estimate, method_name=\"add_unobserved_common_cause\",\n",
" confounders_effect_on_treatment=\"linear\", confounders_effect_on_outcome=\"linear\",\n",
Expand All @@ -478,9 +501,29 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 55,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING:dowhy.causal_refuter:We assume a Normal Distribution as the sample has less than 100 examples.\n",
" Note: The underlying distribution may not be Normal. We assume that it approaches normal with the increase in sample size.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Refute: Use a Placebo Treatment\n",
"Estimated effect:14.994627967720675\n",
"New effect:-0.04089147221035598\n",
"p value:0.3237133144152131\n",
"\n"
]
}
],
"source": [
"res_placebo=model.refute_estimate(identified_estimand, dml_estimate,\n",
" method_name=\"placebo_treatment_refuter\", placebo_type=\"permute\",\n",
Expand All @@ -498,9 +541,29 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 56,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING:dowhy.causal_refuter:We assume a Normal Distribution as the sample has less than 100 examples.\n",
" Note: The underlying distribution may not be Normal. We assume that it approaches normal with the increase in sample size.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Refute: Use a subset of data\n",
"Estimated effect:14.994627967720675\n",
"New effect:14.902535877957828\n",
"p value:0.01665930382063785\n",
"\n"
]
}
],
"source": [
"res_subset=model.refute_estimate(identified_estimand, dml_estimate,\n",
" method_name=\"data_subset_refuter\", subset_fraction=0.8,\n",
Expand Down
5 changes: 1 addition & 4 deletions tests/causal_estimators/test_econml_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,7 @@ def test_iv_estimators(self):
target_units=lambda df: df["X0"] > -1,
confidence_intervals=False,
method_params={
"init_params": {
'discrete_treatment':False,
'discrete_instrument':False
},
"init_params": {"discrete_treatment": False, "discrete_instrument": False},
"fit_params": {},
},
)
Expand Down

0 comments on commit a31c688

Please sign in to comment.