Skip to content

Commit eb1ef79

Browse files
authored
minor fixes to interventional distribution notebook (#553)
* mutilation -> mutation * remove mention of dataframes
1 parent cb48670 commit eb1ef79

File tree

2 files changed

+37
-4
lines changed

2 files changed

+37
-4
lines changed

examples/causal_inference/interventional_distribution.ipynb

+35-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"cells": [
33
{
4+
"attachments": {},
45
"cell_type": "markdown",
56
"id": "f2e8530c-5ba0-4041-a309-18919d5d0533",
67
"metadata": {
@@ -12,7 +13,7 @@
1213
},
1314
"source": [
1415
"(interventional_distribution)=\n",
15-
"# Interventional distributions and graph mutilation with the do-operator\n",
16+
"# Interventional distributions and graph mutation with the do-operator\n",
1617
"\n",
1718
":::{post} July, 2023\n",
1819
":tags: causal inference, do-operator, graph mutation\n",
@@ -22,6 +23,7 @@
2223
]
2324
},
2425
{
26+
"attachments": {},
2527
"cell_type": "markdown",
2628
"id": "8f973a4f-def4-4fb6-b166-2aefbdf5eee2",
2729
"metadata": {
@@ -44,6 +46,7 @@
4446
]
4547
},
4648
{
49+
"attachments": {},
4750
"cell_type": "markdown",
4851
"id": "ed816fbf-320c-44f7-a711-cb4750d86e24",
4952
"metadata": {},
@@ -75,6 +78,7 @@
7578
]
7679
},
7780
{
81+
"attachments": {},
7882
"cell_type": "markdown",
7983
"id": "e2441116-c8a5-41af-be95-9eeddf2b0e2e",
8084
"metadata": {
@@ -136,6 +140,7 @@
136140
]
137141
},
138142
{
143+
"attachments": {},
139144
"cell_type": "markdown",
140145
"id": "782d6135-2e59-4462-8b9c-9832a58751ef",
141146
"metadata": {
@@ -259,6 +264,7 @@
259264
]
260265
},
261266
{
267+
"attachments": {},
262268
"cell_type": "markdown",
263269
"id": "f618f053-266b-4006-a521-f892cb8519e1",
264270
"metadata": {
@@ -281,6 +287,7 @@
281287
]
282288
},
283289
{
290+
"attachments": {},
284291
"cell_type": "markdown",
285292
"id": "ca2ed504-ffda-4f1d-8d18-cdb06608202b",
286293
"metadata": {
@@ -301,6 +308,7 @@
301308
]
302309
},
303310
{
311+
"attachments": {},
304312
"cell_type": "markdown",
305313
"id": "83b8106f-c9e1-4277-ba38-f13b03a33ef6",
306314
"metadata": {
@@ -466,6 +474,7 @@
466474
]
467475
},
468476
{
477+
"attachments": {},
469478
"cell_type": "markdown",
470479
"id": "56832ddc-ef61-4dbf-b46f-b6ef2ae8820e",
471480
"metadata": {
@@ -482,6 +491,7 @@
482491
]
483492
},
484493
{
494+
"attachments": {},
485495
"cell_type": "markdown",
486496
"id": "24792fb8-3e40-41b5-a26a-4a2d4da052ed",
487497
"metadata": {
@@ -503,6 +513,7 @@
503513
]
504514
},
505515
{
516+
"attachments": {},
506517
"cell_type": "markdown",
507518
"id": "aac4d49b-6a1e-4d77-a9c7-205050bebb9f",
508519
"metadata": {
@@ -572,6 +583,7 @@
572583
]
573584
},
574585
{
586+
"attachments": {},
575587
"cell_type": "markdown",
576588
"id": "b70e42b0-61a1-4c62-8dd9-d973d60d7946",
577589
"metadata": {
@@ -727,6 +739,7 @@
727739
]
728740
},
729741
{
742+
"attachments": {},
730743
"cell_type": "markdown",
731744
"id": "3bb5134c-f476-4b8f-9338-1ed07e1fbb13",
732745
"metadata": {
@@ -763,6 +776,7 @@
763776
]
764777
},
765778
{
779+
"attachments": {},
766780
"cell_type": "markdown",
767781
"id": "e2d1a7ca-1948-4165-92aa-3713df60b73b",
768782
"metadata": {},
@@ -773,6 +787,7 @@
773787
]
774788
},
775789
{
790+
"attachments": {},
776791
"cell_type": "markdown",
777792
"id": "453edf32-48d2-4d7f-96fb-6fb61851de9e",
778793
"metadata": {
@@ -783,7 +798,7 @@
783798
"tags": []
784799
},
785800
"source": [
786-
"However, we are going to implement these using Bayesian causal DAGs with PyMC. Let's see how we can do this, then generate samples from them using `pm.sample_prior_predictive`. As we go with each DAG, we'll package the data up in `DataFrame`'s for plotting later, and also plot the graphviz representation of the PyMC models. You'll see that while these are a fraction more visually complex, they do actually match up with the causal DAGs we've specified above."
801+
"However, we are going to implement these using Bayesian causal DAGs with PyMC. Let's see how we can do this, then generate samples from them using `pm.sample_prior_predictive`. As we go with each DAG, we'll extract the samples for plotting later, and also plot the graphviz representation of the PyMC models. You'll see that while these are a fraction more visually complex, they do actually match up with the causal DAGs we've specified above."
787802
]
788803
},
789804
{
@@ -1095,6 +1110,7 @@
10951110
]
10961111
},
10971112
{
1113+
"attachments": {},
10981114
"cell_type": "markdown",
10991115
"id": "07b66542-dd10-43b1-9dfb-5b438f756736",
11001116
"metadata": {
@@ -1164,6 +1180,7 @@
11641180
]
11651181
},
11661182
{
1183+
"attachments": {},
11671184
"cell_type": "markdown",
11681185
"id": "6625a68d-e19e-4490-b486-29e3bff42716",
11691186
"metadata": {
@@ -1178,6 +1195,7 @@
11781195
]
11791196
},
11801197
{
1198+
"attachments": {},
11811199
"cell_type": "markdown",
11821200
"id": "b44eef67-7ad3-46cc-b18c-e589b9fd271b",
11831201
"metadata": {
@@ -1192,6 +1210,7 @@
11921210
]
11931211
},
11941212
{
1213+
"attachments": {},
11951214
"cell_type": "markdown",
11961215
"id": "2d30eb22-2560-495a-8af2-f9c9fe04848a",
11971216
"metadata": {},
@@ -1219,6 +1238,7 @@
12191238
]
12201239
},
12211240
{
1241+
"attachments": {},
12221242
"cell_type": "markdown",
12231243
"id": "99ccc753-e3ef-4834-b02f-4a8d82749fe5",
12241244
"metadata": {},
@@ -1227,6 +1247,7 @@
12271247
]
12281248
},
12291249
{
1250+
"attachments": {},
12301251
"cell_type": "markdown",
12311252
"id": "d0896e42-ee27-4c37-a065-7c78d6f6c0e2",
12321253
"metadata": {
@@ -1321,6 +1342,7 @@
13211342
]
13221343
},
13231344
{
1345+
"attachments": {},
13241346
"cell_type": "markdown",
13251347
"id": "95844edc-2e47-47a1-986a-c6e0b30386c0",
13261348
"metadata": {},
@@ -1471,6 +1493,7 @@
14711493
]
14721494
},
14731495
{
1496+
"attachments": {},
14741497
"cell_type": "markdown",
14751498
"id": "688de710-654d-4905-a328-81941aaa1fe6",
14761499
"metadata": {
@@ -1485,6 +1508,7 @@
14851508
]
14861509
},
14871510
{
1511+
"attachments": {},
14881512
"cell_type": "markdown",
14891513
"id": "01ba8784-cd8b-45e8-b9ec-1fd6d56b010a",
14901514
"metadata": {
@@ -1532,6 +1556,7 @@
15321556
]
15331557
},
15341558
{
1559+
"attachments": {},
15351560
"cell_type": "markdown",
15361561
"id": "d9d4fe62-b694-4a90-9e7f-21344f69fcf6",
15371562
"metadata": {
@@ -1599,6 +1624,7 @@
15991624
]
16001625
},
16011626
{
1627+
"attachments": {},
16021628
"cell_type": "markdown",
16031629
"id": "f546f9e2-0f9b-4eaa-93e3-b5887b757a37",
16041630
"metadata": {
@@ -1675,6 +1701,7 @@
16751701
]
16761702
},
16771703
{
1704+
"attachments": {},
16781705
"cell_type": "markdown",
16791706
"id": "9c4122ee-9709-4c9c-b0eb-a4c20e1b7f3a",
16801707
"metadata": {
@@ -1761,6 +1788,7 @@
17611788
]
17621789
},
17631790
{
1791+
"attachments": {},
17641792
"cell_type": "markdown",
17651793
"id": "dec5c8d6-e562-47ca-a263-2e8269704d04",
17661794
"metadata": {
@@ -1775,6 +1803,7 @@
17751803
]
17761804
},
17771805
{
1806+
"attachments": {},
17781807
"cell_type": "markdown",
17791808
"id": "e546b0ab-dd66-4c20-b814-c8cd1bc6c710",
17801809
"metadata": {
@@ -1797,6 +1826,7 @@
17971826
]
17981827
},
17991828
{
1829+
"attachments": {},
18001830
"cell_type": "markdown",
18011831
"id": "f17a9b3b-a3c2-4919-893b-569049db03d6",
18021832
"metadata": {
@@ -1812,6 +1842,7 @@
18121842
]
18131843
},
18141844
{
1845+
"attachments": {},
18151846
"cell_type": "markdown",
18161847
"id": "ecbb878d-531b-4c96-afe2-c39f928b9162",
18171848
"metadata": {},
@@ -1824,6 +1855,7 @@
18241855
]
18251856
},
18261857
{
1858+
"attachments": {},
18271859
"cell_type": "markdown",
18281860
"id": "9fd548d0-5977-4a19-935a-506e86063887",
18291861
"metadata": {},
@@ -1871,6 +1903,7 @@
18711903
]
18721904
},
18731905
{
1906+
"attachments": {},
18741907
"cell_type": "markdown",
18751908
"id": "62e8040f-452c-4a11-90f5-fa94eb03c971",
18761909
"metadata": {

examples/causal_inference/interventional_distribution.myst.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ kernelspec:
1414
+++ {"editable": true, "slideshow": {"slide_type": ""}, "tags": []}
1515

1616
(interventional_distribution)=
17-
# Interventional distributions and graph mutilation with the do-operator
17+
# Interventional distributions and graph mutation with the do-operator
1818

1919
:::{post} July, 2023
2020
:tags: causal inference, do-operator, graph mutation
@@ -329,7 +329,7 @@ These code snippets are important because they define identical joint distributi
329329

330330
+++ {"editable": true, "slideshow": {"slide_type": ""}, "tags": []}
331331

332-
However, we are going to implement these using Bayesian causal DAGs with PyMC. Let's see how we can do this, then generate samples from them using `pm.sample_prior_predictive`. As we go with each DAG, we'll package the data up in `DataFrame`'s for plotting later, and also plot the graphviz representation of the PyMC models. You'll see that while these are a fraction more visually complex, they do actually match up with the causal DAGs we've specified above.
332+
However, we are going to implement these using Bayesian causal DAGs with PyMC. Let's see how we can do this, then generate samples from them using `pm.sample_prior_predictive`. As we go with each DAG, we'll extract the samples for plotting later, and also plot the graphviz representation of the PyMC models. You'll see that while these are a fraction more visually complex, they do actually match up with the causal DAGs we've specified above.
333333

334334
```{code-cell} ipython3
335335
---

0 commit comments

Comments
 (0)