Skip to content

Commit efcbcc8

Browse files
committed
continuing latex debug
1 parent 7e86a35 commit efcbcc8

File tree

1 file changed

+2
-29
lines changed

1 file changed

+2
-29
lines changed

lab2/Part2_Debiasing.ipynb

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -502,29 +502,6 @@
502502
"where $c$ is a weighting coefficient used for regularization. Now we're ready to define our VAE loss function:"
503503
]
504504
},
505-
{
506-
"cell_type": "markdown",
507-
"metadata": {
508-
"id": "qWxOCPgvv1lf"
509-
},
510-
"source": [
511-
"The equations for both of these losses are provided below.\r\n",
512-
"\r\n",
513-
"\r\n",
514-
"\r\n",
515-
"$$L_{KL}(\\mu, \\sigma) = \\frac{1}{2}\\sum\\limits_{j=0}^{k-1}\\small{(\\sigma_j + \\mu_j^2 - 1 - \\log{\\sigma_j})}$$\r\n",
516-
"\r\n",
517-
"$$L_{x}{(x,\\hat{x})} = ||x-\\hat{x}||_1$$\r\n",
518-
"\r\n",
519-
"Thus for the VAE loss we have: \r\n",
520-
"\r\n",
521-
"$$L_{VAE} = c\\cdot L_{KL} + L_{x}{(x,\\hat{x})}$$\r\n",
522-
"\r\n",
523-
"where $c$ is a weighting coefficient used for regularization. \r\n",
524-
"\r\n",
525-
"Now we're ready to define our VAE loss function:"
526-
]
527-
},
528505
{
529506
"cell_type": "code",
530507
"metadata": {
@@ -581,9 +558,7 @@
581558
"\n",
582559
"As you may recall from lecture, VAEs use a \"reparameterization trick\" for sampling learned latent variables. Instead of the VAE encoder generating a single vector of real numbers for each latent variable, it generates a vector of means and a vector of standard deviations that are constrained to roughly follow Gaussian distributions. We then sample from the standard deviations and add back the mean to output this as our sampled latent vector. Formalizing this for a latent variable $z$ where we sample $\\epsilon \\sim \\mathcal{N}(0,(I))$ we have: \n",
583560
"\n",
584-
"\\begin{equation}\n",
585-
"z = \\mathbb{\\mu} + e^{\\left(\\frac{1}{2} \\cdot \\log{\\Sigma}\\right)}\\circ \\epsilon\n",
586-
"\\end{equation}\n",
561+
"$$z = \\mu + e^{\\left(\\frac{1}{2} \\cdot \\log{\\Sigma}\\right)}\\circ \\epsilon$$\n",
587562
"\n",
588563
"where $\\mu$ is the mean and $\\Sigma$ is the covariance matrix. This is useful because it will let us neatly define the loss function for the VAE, generate randomly sampled latent variables, achieve improved network generalization, **and** make our complete VAE network differentiable so that it can be trained via backpropagation. Quite powerful!\n",
589564
"\n",
@@ -667,9 +642,7 @@
667642
"\n",
668643
"We can write a single expression for the loss by defining an indicator variable $\\mathcal{I}_f$which reflects which training data are images of faces ($\\mathcal{I}_f(y) = 1$ ) and which are images of non-faces ($\\mathcal{I}_f(y) = 0$). Using this, we obtain:\n",
669644
"\n",
670-
"\\begin{equation}\n",
671-
"L_{total} = L_y(y,\\hat{y}) + \\mathcal{I}_f(y)\\Big[L_{VAE}\\Big]\n",
672-
"\\end{equation}\n",
645+
"$$L_{total} = L_y(y,\\hat{y}) + \\mathcal{I}_f(y)\\Big[L_{VAE}\\Big]$$\n",
673646
"\n",
674647
"Let's write a function to define the DB-VAE loss function:\n",
675648
"\n"

0 commit comments

Comments
 (0)