Mathematics for AI and Machine Learning

Foundations for modern AI and machine learning

Latent Variable Model

Chapter 16 Probability & information

Chapter 16: Variational Inference and Latent Variables — Latent Variables and Marginal Likelihood

Animated preview (GIF)
Latent Variable Model — animated GIF preview
High-resolution PNG
Latent Variable Model — high-resolution mind-map icon

From the book

Chapter 16: Variational Inference and Latent Variables. In the chapter mind map this icon labels **Latent Variables & Marginal Likelihood $p(\mathbf{x})$. The discussion below is excerpted and lightly edited from § Latent Variables and Marginal Likelihood** in Mathematics for AI and Machine Learning.

For discrete latent variables (e.g., categorical variables $z \in \{0, 1, \ldots, K-1\}$), direct sampling from $q_{\boldsymbol\phi}(z | \mathbf x)$ is non-differentiable, preventing gradient-based optimization. The Gumbel-Softmax trick (also called the concrete distribution) provides a continuous relaxation that enables gradient flow.

What this drawing shows

What you see. Latent $z$ and label $p(x \mid z)$ fixed; generative arrow and observed pixels fill in as the model draws $x$ from $z$.

In the mind map. Chapter 16 — Latent Variables & Marginal Likelihood. See From the book above for definitions, figures, and worked examples.

Where to read next

Open Chapter 16 companion →

Read the full definitions, figures, and worked examples in Chapter 16: Variational Inference and Latent Variables — see the mind-map node Latent Variables & Marginal Likelihood.