Latent variables are variables that are not directly observed but are inferred from other observable variables in the model. They play a crucial role in generative models, where the goal is to generate data from a learned distribution.

Definition

Latent variables are hidden variables that influence the observed data but are not directly measurable. They allow generative models to learn complex distributions by capturing hidden structure.

Why Latent Variables Matter

Latent variables are important because they allow generative models to:

  • Capture complex patterns in the data.
  • Generate new samples from the learned distribution.
  • Enable dimensionality reduction by mapping data into a latent space.

Examples of Latent Variable Models

  1. Variational Autoencoders (VAEs): A VAE learns to encode data into a lower-dimensional latent space and then decodes from that space to reconstruct the original data.
  2. Generative Adversarial Networks (GANs): GANs use latent variables to map random noise vectors to generated data.

Mathematical Representation

In the context of generative models, let:

  • be the latent variable.
  • be the observable data.

A generative model defines a distribution over the data given the latent variable . To generate data, we sample from the prior and then from .

In this formulation, captures the hidden factors that influence the observed data . The model learns the distribution that maps latent variables to observable data.

Latent Space Interpretation

The latent space is typically a lower-dimensional representation of the data. In VAEs, this space is continuous, while in GANs, the latent space is often a high-dimensional noise vector.

Role in Inference

In generative models, the latent variables are usually inferred by maximizing the likelihood of the observed data. For example, in VAEs, we optimize the evidence lower bound (ELBO) to estimate the parameters of the model:

Here, is the approximate posterior of the latent variable, and refers to the Kullback-Leibler divergence, which measures the difference between the approximate and true posterior distributions.

Practical Example

In practice, latent variables can represent abstract concepts like the style of an image, facial expression, or even handwriting. They allow models to disentangle different features and generate new combinations of these features.

Summary

Latent variables are fundamental in generative machine learning models because they allow us to model complex data distributions, perform dimensionality reduction, and generate new data. By learning the relationships between latent variables and observed data, generative models can uncover the hidden structure of the data and produce meaningful outputs.