Skip to content

Commit 5f106c9

Browse files
Víctor Quintas-MartínezVíctor Quintas-Martínez
authored andcommitted
Cleanup imports, remove sns from example notebook
1 parent 561e857 commit 5f106c9

File tree

1 file changed

+4
-27
lines changed

1 file changed

+4
-27
lines changed

docs/source/example_notebooks/gcm_cps2015_dist_change_robust.ipynb

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,5 @@
11
{
22
"cells": [
3-
{
4-
"cell_type": "code",
5-
"execution_count": null,
6-
"id": "b7dab0bd",
7-
"metadata": {
8-
"tags": []
9-
},
10-
"outputs": [],
11-
"source": [
12-
"import numpy as np\n",
13-
"import networkx as nx\n",
14-
"import matplotlib.pyplot as plt\n",
15-
"import seaborn as sns\n",
16-
"from lightgbm import LGBMClassifier, LGBMRegressor\n",
17-
"from scipy.stats import norm\n",
18-
"from sklearn.isotonic import IsotonicRegression\n",
19-
"from sklearn.model_selection import train_test_split\n",
20-
"from scipy.stats import sem\n",
21-
"from statsmodels.stats.weightstats import DescrStatsW\n",
22-
"from pickle import dump, load\n",
23-
"from itertools import compress, product\n",
24-
"from math import comb\n",
25-
"import dowhy.gcm as gcm"
26-
]
27-
},
283
{
294
"cell_type": "markdown",
305
"id": "b075c6f9-2474-449f-8191-a45d77b6d3f8",
@@ -224,6 +199,7 @@
224199
"import itertools\n",
225200
"from dowhy.gcm.distribution_change_robust import ThetaC\n",
226201
"import numpy as np\n",
202+
"from math import comb\n",
227203
"\n",
228204
"# All combinations of 0s and 1s, needed for Shapley Values:\n",
229205
"all_combos = [list(i) for i in itertools.product([0, 1], repeat=3)]\n",
@@ -335,6 +311,7 @@
335311
"from scipy.stats import norm\n",
336312
"from statsmodels.stats.weightstats import DescrStatsW\n",
337313
"from matplotlib.patches import Rectangle\n",
314+
"import matplotlib.pyplot as plt\n",
338315
"\n",
339316
"# Significance stars:\n",
340317
"def star(est, se):\n",
@@ -389,7 +366,7 @@
389366
"\n",
390367
"First, notice that the Shapley values for $P(\\mathtt{educ})$, $P(\\mathtt{occup} \\mid \\mathtt{educ})$ and $P(\\mathtt{wage} \\mid \\mathtt{occup}, \\mathtt{educ})$ add up to the total effect.\n",
391368
"\n",
392-
"Second, the Shapley value for $P(\\mathtt{educ})$ is positive and statistically significant. One way to interpret this measure is that, if men and women differed only in their $P(\\mathtt{educ})$ (but their other causal mechanisms were the same), women would earn \\\\$1.22/hour more than men on average. Conversely, the Shapley value for $P(\\mathtt{educ} \\mid \\mathtt{educ})$ is negative, statistically significant and of approximately the same magnitude as the first Shapley value, hence cancelling out with the effect of differences in education. These effects measure two things:\n",
369+
"Second, the Shapley value for $P(\\mathtt{educ})$ is positive and statistically significant. One way to interpret this measure is that, if men and women differed only in their $P(\\mathtt{educ})$ (but their other causal mechanisms were the same), women would earn \\\\$1.12/hour more than men on average. Conversely, the Shapley value for $P(\\mathtt{educ} \\mid \\mathtt{educ})$ is negative, statistically significant and of slightly larger magnitude as the first Shapley value, hence cancelling out with the effect of differences in education. These effects measure two things:\n",
393370
"1. How different is a causal mechanism between males and females?\n",
394371
"2. How important is a causal mechanism for the outcome?\n",
395372
"\n",
@@ -453,7 +430,7 @@
453430
"source": [
454431
"Women with college degrees are more predominant in administrative, education or healthcare occupations, whereas men with college degrees are more likely to work in management or sales. For comparison, managers earn \\\\$16.66/hour more than educators and \\\\$6.29/hour more than healthcare practitioners on average. \n",
455432
"\n",
456-
"At the same time, however, there are large differences that cannot be explained by education or occupation. For example, female college graduate managers earn \\\\$14.84/hour less than their male counterparts."
433+
"At the same time, however, there are large differences that cannot be explained by education or occupation. For example, female college graduate managers earn \\\\$13.77/hour less than their male counterparts."
457434
]
458435
},
459436
{

0 commit comments

Comments
 (0)