updating experimental econml notebook, drlearner still has bugs

This commit is contained in:
Amit Sharma 2019-12-12 23:08:42 -08:00
Родитель 4c7e96d5d2
Коммит 0c8d44eb14
2 изменённых файлов: 1133 добавлений и 229 удалений

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -170,7 +170,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"INFO:dowhy.causal_identifier:Common causes of treatment and outcome:['W2', 'W1', 'Unobserved Confounders', 'W3', 'W0', 'W4']\n",
"INFO:dowhy.causal_identifier:Common causes of treatment and outcome:['W2', 'W4', 'Unobserved Confounders', 'W0', 'W3', 'W1']\n",
"WARNING:dowhy.causal_identifier:There are unobserved common causes. Causal effect cannot be identified.\n"
]
},
@ -185,7 +185,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"INFO:dowhy.causal_identifier:Instrumental variables for treatment and outcome:['Z0', 'Z1']\n"
"INFO:dowhy.causal_identifier:Instrumental variables for treatment and outcome:['Z1', 'Z0']\n"
]
},
{
@ -197,15 +197,15 @@
"Estimand name: backdoor\n",
"Estimand expression:\n",
" d \n",
"───(Expectation(y|W2,W1,W3,W0,W4))\n",
"───(Expectation(y|W2,W4,W0,W3,W1))\n",
"dv₀ \n",
"Estimand assumption 1, Unconfoundedness: If U→v0 and U→y then P(y|v0,W2,W1,W3,W0,W4,U) = P(y|v0,W2,W1,W3,W0,W4)\n",
"Estimand assumption 1, Unconfoundedness: If U→v0 and U→y then P(y|v0,W2,W4,W0,W3,W1,U) = P(y|v0,W2,W4,W0,W3,W1)\n",
"### Estimand : 2\n",
"Estimand name: iv\n",
"Estimand expression:\n",
"Expectation(Derivative(y, Z0)/Derivative(v0, Z0))\n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z0,Z1)\n",
"Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→v0, then ¬(Z0,Z1→y)\n",
"Expectation(Derivative(y, Z1)/Derivative(v0, Z1))\n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z1,Z0)\n",
"Estimand assumption 2, Exclusion: If we remove {Z1,Z0}→v0, then ¬(Z1,Z0→y)\n",
"\n"
]
}
@ -234,7 +234,7 @@
"output_type": "stream",
"text": [
"INFO:dowhy.causal_estimator:INFO: Using Linear Regression Estimator\n",
"INFO:dowhy.causal_estimator:b: y~v0+W2+W1+W3+W0+W4\n"
"INFO:dowhy.causal_estimator:b: y~v0+W2+W4+W0+W3+W1\n"
]
},
{
@ -249,25 +249,25 @@
"Estimand name: backdoor\n",
"Estimand expression:\n",
" d \n",
"───(Expectation(y|W2,W1,W3,W0,W4))\n",
"───(Expectation(y|W2,W4,W0,W3,W1))\n",
"dv₀ \n",
"Estimand assumption 1, Unconfoundedness: If U→v0 and U→y then P(y|v0,W2,W1,W3,W0,W4,U) = P(y|v0,W2,W1,W3,W0,W4)\n",
"Estimand assumption 1, Unconfoundedness: If U→v0 and U→y then P(y|v0,W2,W4,W0,W3,W1,U) = P(y|v0,W2,W4,W0,W3,W1)\n",
"### Estimand : 2\n",
"Estimand name: iv\n",
"Estimand expression:\n",
"Expectation(Derivative(y, Z0)/Derivative(v0, Z0))\n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z0,Z1)\n",
"Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→v0, then ¬(Z0,Z1→y)\n",
"Expectation(Derivative(y, Z1)/Derivative(v0, Z1))\n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z1,Z0)\n",
"Estimand assumption 2, Exclusion: If we remove {Z1,Z0}→v0, then ¬(Z1,Z0→y)\n",
"\n",
"## Realized estimand\n",
"b: y~v0+W2+W1+W3+W0+W4\n",
"b: y~v0+W2+W4+W0+W3+W1\n",
"## Estimate\n",
"Value: 10.000000000000338\n",
"Value: 9.999999999999693\n",
"\n",
"## Statistical Significance\n",
"p-value: <0.001\n",
"\n",
"Causal Estimate is 10.000000000000338\n"
"Causal Estimate is 9.999999999999693\n"
]
}
],
@ -298,7 +298,7 @@
"output_type": "stream",
"text": [
"INFO:dowhy.causal_estimator:INFO: Using Propensity Score Stratification Estimator\n",
"INFO:dowhy.causal_estimator:b: y~v0+W2+W1+W3+W0+W4\n",
"INFO:dowhy.causal_estimator:b: y~v0+W2+W4+W0+W3+W1\n",
"/home/amit/.local/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" y = column_or_1d(y, warn=True)\n"
]
@ -315,22 +315,22 @@
"Estimand name: backdoor\n",
"Estimand expression:\n",
" d \n",
"───(Expectation(y|W2,W1,W3,W0,W4))\n",
"───(Expectation(y|W2,W4,W0,W3,W1))\n",
"dv₀ \n",
"Estimand assumption 1, Unconfoundedness: If U→v0 and U→y then P(y|v0,W2,W1,W3,W0,W4,U) = P(y|v0,W2,W1,W3,W0,W4)\n",
"Estimand assumption 1, Unconfoundedness: If U→v0 and U→y then P(y|v0,W2,W4,W0,W3,W1,U) = P(y|v0,W2,W4,W0,W3,W1)\n",
"### Estimand : 2\n",
"Estimand name: iv\n",
"Estimand expression:\n",
"Expectation(Derivative(y, Z0)/Derivative(v0, Z0))\n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z0,Z1)\n",
"Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→v0, then ¬(Z0,Z1→y)\n",
"Expectation(Derivative(y, Z1)/Derivative(v0, Z1))\n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z1,Z0)\n",
"Estimand assumption 2, Exclusion: If we remove {Z1,Z0}→v0, then ¬(Z1,Z0→y)\n",
"\n",
"## Realized estimand\n",
"b: y~v0+W2+W1+W3+W0+W4\n",
"b: y~v0+W2+W4+W0+W3+W1\n",
"## Estimate\n",
"Value: 10.418874541461191\n",
"Value: 10.023434125219422\n",
"\n",
"Causal Estimate is 10.418874541461191\n"
"Causal Estimate is 10.023434125219422\n"
]
}
],
@ -360,7 +360,7 @@
"output_type": "stream",
"text": [
"INFO:dowhy.causal_estimator:INFO: Using Propensity Score Matching Estimator\n",
"INFO:dowhy.causal_estimator:b: y~v0+W2+W1+W3+W0+W4\n",
"INFO:dowhy.causal_estimator:b: y~v0+W2+W4+W0+W3+W1\n",
"/home/amit/.local/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" y = column_or_1d(y, warn=True)\n",
"/mnt/c/Users/amshar/code/dowhy/dowhy/causal_estimators/propensity_score_matching_estimator.py:62: FutureWarning: `item` has been deprecated and will be removed in a future version\n",
@ -379,22 +379,22 @@
"Estimand name: backdoor\n",
"Estimand expression:\n",
" d \n",
"───(Expectation(y|W2,W1,W3,W0,W4))\n",
"───(Expectation(y|W2,W4,W0,W3,W1))\n",
"dv₀ \n",
"Estimand assumption 1, Unconfoundedness: If U→v0 and U→y then P(y|v0,W2,W1,W3,W0,W4,U) = P(y|v0,W2,W1,W3,W0,W4)\n",
"Estimand assumption 1, Unconfoundedness: If U→v0 and U→y then P(y|v0,W2,W4,W0,W3,W1,U) = P(y|v0,W2,W4,W0,W3,W1)\n",
"### Estimand : 2\n",
"Estimand name: iv\n",
"Estimand expression:\n",
"Expectation(Derivative(y, Z0)/Derivative(v0, Z0))\n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z0,Z1)\n",
"Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→v0, then ¬(Z0,Z1→y)\n",
"Expectation(Derivative(y, Z1)/Derivative(v0, Z1))\n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z1,Z0)\n",
"Estimand assumption 2, Exclusion: If we remove {Z1,Z0}→v0, then ¬(Z1,Z0→y)\n",
"\n",
"## Realized estimand\n",
"b: y~v0+W2+W1+W3+W0+W4\n",
"b: y~v0+W2+W4+W0+W3+W1\n",
"## Estimate\n",
"Value: 9.900673739687496\n",
"Value: 16.567950719540818\n",
"\n",
"Causal Estimate is 9.900673739687496\n"
"Causal Estimate is 16.567950719540818\n"
]
}
],
@ -427,7 +427,7 @@
"output_type": "stream",
"text": [
"INFO:dowhy.causal_estimator:INFO: Using Propensity Score Weighting Estimator\n",
"INFO:dowhy.causal_estimator:b: y~v0+W2+W1+W3+W0+W4\n"
"INFO:dowhy.causal_estimator:b: y~v0+W2+W4+W0+W3+W1\n"
]
},
{
@ -442,22 +442,22 @@
"Estimand name: backdoor\n",
"Estimand expression:\n",
" d \n",
"───(Expectation(y|W2,W1,W3,W0,W4))\n",
"───(Expectation(y|W2,W4,W0,W3,W1))\n",
"dv₀ \n",
"Estimand assumption 1, Unconfoundedness: If U→v0 and U→y then P(y|v0,W2,W1,W3,W0,W4,U) = P(y|v0,W2,W1,W3,W0,W4)\n",
"Estimand assumption 1, Unconfoundedness: If U→v0 and U→y then P(y|v0,W2,W4,W0,W3,W1,U) = P(y|v0,W2,W4,W0,W3,W1)\n",
"### Estimand : 2\n",
"Estimand name: iv\n",
"Estimand expression:\n",
"Expectation(Derivative(y, Z0)/Derivative(v0, Z0))\n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z0,Z1)\n",
"Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→v0, then ¬(Z0,Z1→y)\n",
"Expectation(Derivative(y, Z1)/Derivative(v0, Z1))\n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z1,Z0)\n",
"Estimand assumption 2, Exclusion: If we remove {Z1,Z0}→v0, then ¬(Z1,Z0→y)\n",
"\n",
"## Realized estimand\n",
"b: y~v0+W2+W1+W3+W0+W4\n",
"b: y~v0+W2+W4+W0+W3+W1\n",
"## Estimate\n",
"Value: 10.18763893548709\n",
"Value: 19.171266513511014\n",
"\n",
"Causal Estimate is 10.18763893548709\n"
"Causal Estimate is 19.171266513511014\n"
]
},
{
@ -499,9 +499,9 @@
"Realized estimand type: ate\n",
"Estimand expression:\n",
" -1\n",
"Expectation(Derivative(y, Z0))⋅Expectation(Derivative(v0, Z0)) \n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z0,Z1)\n",
"Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→v0, then ¬(Z0,Z1→y)\n",
"Expectation(Derivative(y, Z1))⋅Expectation(Derivative(v0, Z1)) \n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z1,Z0)\n",
"Estimand assumption 2, Exclusion: If we remove {Z1,Z0}→v0, then ¬(Z1,Z0→y)\n",
"Estimand assumption 3, treatment_effect_homogeneity: Each unit's treatment ['v0'] isaffected in the same way by common causes of ['v0'] and y\n",
"Estimand assumption 4, outcome_effect_homogeneity: Each unit's outcome y isaffected in the same way by common causes of ['v0'] and y\n",
"\n"
@ -519,31 +519,31 @@
"Estimand name: backdoor\n",
"Estimand expression:\n",
" d \n",
"───(Expectation(y|W2,W1,W3,W0,W4))\n",
"───(Expectation(y|W2,W4,W0,W3,W1))\n",
"dv₀ \n",
"Estimand assumption 1, Unconfoundedness: If U→v0 and U→y then P(y|v0,W2,W1,W3,W0,W4,U) = P(y|v0,W2,W1,W3,W0,W4)\n",
"Estimand assumption 1, Unconfoundedness: If U→v0 and U→y then P(y|v0,W2,W4,W0,W3,W1,U) = P(y|v0,W2,W4,W0,W3,W1)\n",
"### Estimand : 2\n",
"Estimand name: iv\n",
"Estimand expression:\n",
"Expectation(Derivative(y, Z0)/Derivative(v0, Z0))\n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z0,Z1)\n",
"Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→v0, then ¬(Z0,Z1→y)\n",
"Expectation(Derivative(y, Z1)/Derivative(v0, Z1))\n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z1,Z0)\n",
"Estimand assumption 2, Exclusion: If we remove {Z1,Z0}→v0, then ¬(Z1,Z0→y)\n",
"\n",
"## Realized estimand\n",
"Realized estimand: Wald Estimator\n",
"Realized estimand type: ate\n",
"Estimand expression:\n",
" -1\n",
"Expectation(Derivative(y, Z0))⋅Expectation(Derivative(v0, Z0)) \n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z0,Z1)\n",
"Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→v0, then ¬(Z0,Z1→y)\n",
"Expectation(Derivative(y, Z1))⋅Expectation(Derivative(v0, Z1)) \n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z1,Z0)\n",
"Estimand assumption 2, Exclusion: If we remove {Z1,Z0}→v0, then ¬(Z1,Z0→y)\n",
"Estimand assumption 3, treatment_effect_homogeneity: Each unit's treatment ['v0'] isaffected in the same way by common causes of ['v0'] and y\n",
"Estimand assumption 4, outcome_effect_homogeneity: Each unit's outcome y isaffected in the same way by common causes of ['v0'] and y\n",
"\n",
"## Estimate\n",
"Value: 9.55482869339338\n",
"Value: 7.758247503107021\n",
"\n",
"Causal Estimate is 9.55482869339338\n"
"Causal Estimate is 7.758247503107021\n"
]
}
],
@ -579,9 +579,9 @@
"Realized estimand type: ate\n",
"Estimand expression:\n",
" -1\n",
"Expectation(Derivative(y, Z0))⋅Expectation(Derivative(v0, Z0)) \n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z0,Z1)\n",
"Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→v0, then ¬(Z0,Z1→y)\n",
"Expectation(Derivative(y, Z1))⋅Expectation(Derivative(v0, Z1)) \n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z1,Z0)\n",
"Estimand assumption 2, Exclusion: If we remove {Z1,Z0}→v0, then ¬(Z1,Z0→y)\n",
"Estimand assumption 3, treatment_effect_homogeneity: Each unit's treatment ['local_treatment'] isaffected in the same way by common causes of ['local_treatment'] and local_outcome\n",
"Estimand assumption 4, outcome_effect_homogeneity: Each unit's outcome local_outcome isaffected in the same way by common causes of ['local_treatment'] and local_outcome\n",
"\n"
@ -591,31 +591,6 @@
"name": "stdout",
"output_type": "stream",
"text": [
" v0\n",
"0 True\n",
"1 True\n",
"2 False\n",
"3 True\n",
"4 True\n",
"... ...\n",
"9995 True\n",
"9996 False\n",
"9997 True\n",
"9998 True\n",
"9999 True\n",
"\n",
"[10000 rows x 1 columns] 7 True\n",
"11 True\n",
"12 True\n",
"13 True\n",
"16 True\n",
" ... \n",
"9985 True\n",
"9988 True\n",
"9991 True\n",
"9998 True\n",
"9999 True\n",
"Name: v0, Length: 2027, dtype: bool\n",
"*** Causal Estimate ***\n",
"\n",
"## Target estimand\n",
@ -624,31 +599,31 @@
"Estimand name: backdoor\n",
"Estimand expression:\n",
" d \n",
"───(Expectation(y|W2,W1,W3,W0,W4))\n",
"───(Expectation(y|W2,W4,W0,W3,W1))\n",
"dv₀ \n",
"Estimand assumption 1, Unconfoundedness: If U→v0 and U→y then P(y|v0,W2,W1,W3,W0,W4,U) = P(y|v0,W2,W1,W3,W0,W4)\n",
"Estimand assumption 1, Unconfoundedness: If U→v0 and U→y then P(y|v0,W2,W4,W0,W3,W1,U) = P(y|v0,W2,W4,W0,W3,W1)\n",
"### Estimand : 2\n",
"Estimand name: iv\n",
"Estimand expression:\n",
"Expectation(Derivative(y, Z0)/Derivative(v0, Z0))\n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z0,Z1)\n",
"Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→v0, then ¬(Z0,Z1→y)\n",
"Expectation(Derivative(y, Z1)/Derivative(v0, Z1))\n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z1,Z0)\n",
"Estimand assumption 2, Exclusion: If we remove {Z1,Z0}→v0, then ¬(Z1,Z0→y)\n",
"\n",
"## Realized estimand\n",
"Realized estimand: Wald Estimator\n",
"Realized estimand type: ate\n",
"Estimand expression:\n",
" -1\n",
"Expectation(Derivative(y, Z0))⋅Expectation(Derivative(v0, Z0)) \n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z0,Z1)\n",
"Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→v0, then ¬(Z0,Z1→y)\n",
"Expectation(Derivative(y, Z1))⋅Expectation(Derivative(v0, Z1)) \n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→Z1,Z0)\n",
"Estimand assumption 2, Exclusion: If we remove {Z1,Z0}→v0, then ¬(Z1,Z0→y)\n",
"Estimand assumption 3, treatment_effect_homogeneity: Each unit's treatment ['local_treatment'] isaffected in the same way by common causes of ['local_treatment'] and local_outcome\n",
"Estimand assumption 4, outcome_effect_homogeneity: Each unit's outcome local_outcome isaffected in the same way by common causes of ['local_treatment'] and local_outcome\n",
"\n",
"## Estimate\n",
"Value: -41.06170465610914\n",
"Value: -48.97868379208166\n",
"\n",
"Causal Estimate is -41.06170465610914\n"
"Causal Estimate is -48.97868379208166\n"
]
}
],