Skip to content

Commit 868ca6d

Browse files
committed
DL2 CRL: Fixing website issues
1 parent ca0044a commit 868ca6d

File tree

2 files changed

+21
-29
lines changed

2 files changed

+21
-29
lines changed

docs/tutorial_notebooks/DL2/Causality_and_CRL/citris-tutorial.ipynb

+21-29
Original file line numberDiff line numberDiff line change
@@ -206,23 +206,9 @@
206206
"\n",
207207
"It is noteworthy that the set-up of TRIS is general enough to be able to describe many dynamical systems. In fact, CITRIS (and iCITRIS ([Lippe et al., 2022b](https://arxiv.org/abs/2206.06169)), which we do not discuss in this notebook) have been successful in identifying the causal structure in settings that range from 3D rendered objects to pinball and pong.\n",
208208
"\n",
209-
"<div style=\"display: flex;\">\n",
210-
" <div style=\"margin-left: 20px; margin-right: 20px;\">\n",
211-
" <img src=\"figures/datasets/ball_in_boxes.gif\" width=\"200px\">\n",
212-
" </div>\n",
213-
" <div style=\"margin-right: 20px;\">\n",
214-
" <img src=\"figures/datasets/causal-3dIdent.gif\" width=\"200px\">\n",
215-
" </div>\n",
216-
" <div style=\"margin-right: 20px;\">\n",
217-
" <img src=\"figures/datasets/interventional_pong2.gif\" width=\"200px\">\n",
218-
" </div>\n",
219-
" <div style=\"margin-right: 20px;\">\n",
220-
" <img src=\"figures/datasets/voronoi.gif\" width=\"200px\">\n",
221-
" </div>\n",
222-
" <div style=\"margin-right: 20px;\">\n",
223-
" <img src=\"figures/datasets/pinball2.gif\" width=\"200px\">\n",
224-
" </div>\n",
225-
"</div>\n",
209+
"| | | | | |\n",
210+
"| --- | --- | --- | --- | --- |\n",
211+
"| <img src=\"figures/datasets/ball_in_boxes.gif\" width=\"200px\"> | <img src=\"figures/datasets/causal-3dIdent.gif\" width=\"200px\"> | <img src=\"figures/datasets/interventional_pong2.gif\" width=\"200px\"> | <img src=\"figures/datasets/voronoi.gif\" width=\"200px\"> | <img src=\"figures/datasets/pinball2.gif\" width=\"200px\"> |\n",
226212
"\n",
227213
"In the remainder of this tutorial, we will focus on the Causal3DIdent dataset, which we will describe in further detail next."
228214
]
@@ -766,16 +752,15 @@
766752
"For the assignment function, $\\psi(j)=0,j\\in[\\![1..M]\\!]$ indicates that the latent dimension $z_j$ does not correspond to any dimension of the minimal causal variable, but rather to some dimension of $s^\\text{inv}_i(C^{t}_i)$, and $z_{\\psi_{i}}=\\{z_j \\mid j\\in[\\![1..M]\\!], \\psi(j)=i\\}$ denotes the set of latent variables that $\\psi$ assigns to the causal variable $C_i$.\n",
767753
"\n",
768754
"To encourage a disentanglement of the causal factors, CITRIS model a **transition prior** in the latent space that conditions each latent variable on exactly one of the intervention targets:\n",
755+
"\n",
769756
"$$\n",
770-
"\\begin{equation}\n",
771-
" p_{\\phi}\\left(z^{t+1}|z^{t}, I^{t+1}\\right) = \\prod_{i=0}^{K}p_{\\phi}\\left(z_{\\psi_i}^{t+1}|z^{t}, I_{i}^{t+1}\\right),\n",
772-
"\\end{equation}\n",
757+
"p_{\\phi}\\left(z^{t+1}|z^{t}, I^{t+1}\\right) = \\prod_{i=0}^{K}p_{\\phi}\\left(z_{\\psi_i}^{t+1}|z^{t}, I_{i}^{t+1}\\right),\n",
773758
"$$\n",
759+
"\n",
774760
"where $I_0^{t+1}=0$. Combining the transition prior and the invertible mapping $g_\\theta$, the objective of CITRIS is to maximize the following likelihood:\n",
761+
"\n",
775762
"$$\n",
776-
"\\begin{equation}\n",
777-
" p_{\\phi,\\theta}(x^{t+1}|x^{t},I^{t+1})=\\left|\\frac{\\partial g_{\\theta}(x^{t+1})}{\\partial x^{t+1}}\\right|p_{\\phi}(z^{t+1}|z^{t}, I^{t+1})\n",
778-
"\\end{equation}\n",
763+
"p_{\\phi,\\theta}(x^{t+1}|x^{t},I^{t+1})=\\left|\\frac{\\partial g_{\\theta}(x^{t+1})}{\\partial x^{t+1}}\\right|p_{\\phi}(z^{t+1}|z^{t}, I^{t+1})\n",
779764
"$$\n",
780765
"\n",
781766
"If a model $\\mathcal{M}$ maximizes the information content of $z_{\\psi_0}$ under the constraint of maximizing this likelihood $\\mathcal{L}_{\\phi,\\theta}(x^{t+1}|x^{t},I^{t+1})$ and no intervention variable is a deterministic function of any other intervention variable, then $\\mathcal{M}$ is shown to identify any causal system $\\mathcal{S}$ (i.e., it identifies the minimal causal variables of $\\mathcal{S}$ up to an invertible transformation). Intuitively, this means that the latent variables $z_{\\psi_i}$ only model the information of $C_i$ that strictly depends on the intervention targets $I_i^{t+1}$. "
@@ -807,11 +792,11 @@
807792
"metadata": {},
808793
"source": [
809794
"Recall that CITRIS approximates $h^{-1}: \\mathcal{X} \\to \\mathcal{C} \\times \\mathcal{E}$ by learning two components: the intertible mapping $g_\\theta: \\mathcal{X} \\to \\mathcal{Z}$, and the assignment function $\\psi: [\\![1..M]\\!]\\to[\\![0..K]\\!]$. CITRIS-VAE approximate $g_\\theta$ via a variational autoencoder (AE), with encoder $q_\\theta$ and decoder $p_\\theta$, that optimizes the following Evidence Lower Bound (ELBO):\n",
795+
"\n",
810796
"$$\n",
811-
"\\begin{equation}\n",
812-
" \\mathcal{L}_{\\text{ELBO}} = -\\mathbb{E}_{z^{t+1}}\\left[\\log \\underbrace{p_{\\theta}\\left(x^{t+1}|z^{t+1}\\right)}_\\text{Decoder}\\right] + \\mathbb{E}_{z^{t},\\psi}\\left[\\sum_{i=0}^{K} D_{\\mathrm{KL}}\\left(\\underbrace{q_{\\theta}(z_{\\psi_{i}}^{t+1}|x^{t+1})}_\\text{Encoder}|| \\underbrace{p_{\\phi}(z_{\\psi_{i}}^{t+1}|z^{t}, I_{i}^{t+1})}_\\text{Transition Prior}\\right)\\right]\n",
813-
"\\end{equation}\n",
797+
"\\mathcal{L}_{\\text{ELBO}} = -\\mathbb{E}_{z^{t+1}}\\left[\\log \\underbrace{p_{\\theta}\\left(x^{t+1}|z^{t+1}\\right)}_\\text{Decoder}\\right] + \\mathbb{E}_{z^{t},\\psi}\\left[\\sum_{i=0}^{K} D_{\\mathrm{KL}}\\left(\\underbrace{q_{\\theta}(z_{\\psi_{i}}^{t+1}|x^{t+1})}_\\text{Encoder}|| \\underbrace{p_{\\phi}(z_{\\psi_{i}}^{t+1}|z^{t}, I_{i}^{t+1})}_\\text{Transition Prior}\\right)\\right]\n",
814798
"$$\n",
799+
"\n",
815800
"To ensure that blocks of latent variables that are assigned to different causal variables are independent conditioned on the latent variables of the previous time steps and the interventions (i.e., the $z_{\\psi_i}^{t+1}$'s are independent conditioned on $z^t$ and $I_i^{t+1}$), the KL divergence term utilizes the prior definition of the transition prior. Thereby, the assignment function $\\psi$ is learned via a Gumbel-Softmax distribution per latent variable. The overall setup of CITRIS-VAE is visualized below.\n",
816801
"\n",
817802
"<center width=\"100%\"><img src=\"figures/CITRIS-VAE.png\" width=\"50%\"></center>"
@@ -3957,7 +3942,7 @@
39573942
"cell_type": "markdown",
39583943
"metadata": {},
39593944
"source": [
3960-
"We then visualize what happens to the latent space by these isolated changes using a bar plot. You can use the slider to control for which frame the latent dimensions are visualized (note that you might have to open the notebook in Colab in order to use the slider)."
3945+
"We then visualize what happens to the latent space by these isolated changes using a bar plot. You can use the slider to control for which frame the latent dimensions are visualized (note that you might have to open the notebook in Colab in order to use the slider, the GIF below iterates through the different images)."
39613946
]
39623947
},
39633948
{
@@ -4014,6 +3999,13 @@
40143999
"visualize_latents.widget.children[0].layout.width = '100%'"
40154000
]
40164001
},
4002+
{
4003+
"cell_type": "markdown",
4004+
"metadata": {},
4005+
"source": [
4006+
"<img src=\"figures/visualize_latents.gif\" width=\"50%\"/>"
4007+
]
4008+
},
40174009
{
40184010
"cell_type": "markdown",
40194011
"metadata": {},
@@ -4058,7 +4050,7 @@
40584050
],
40594051
"metadata": {
40604052
"kernelspec": {
4061-
"display_name": "Python 3 (ipykernel)",
4053+
"display_name": "Python 3",
40624054
"language": "python",
40634055
"name": "python3"
40644056
},
@@ -4072,7 +4064,7 @@
40724064
"name": "python",
40734065
"nbconvert_exporter": "python",
40744066
"pygments_lexer": "ipython3",
4075-
"version": "3.8.15"
4067+
"version": "3.7.9"
40764068
}
40774069
},
40784070
"nbformat": 4,
Loading

0 commit comments

Comments
 (0)