liveBook · Manning

Kullback–Leibler divergence

As explained in Deep Learning with R, Third Edition

Kullback–Leibler divergence is a measure of how one probability distribution differs from a reference probability distribution.

Kullback–Leibler divergence measures how an encoder’s probability distribution differs from a reference distribution. In a variational autoencoder, it acts as a regularization loss alongside reconstruction loss. section 17.1.2

The regularization term nudges the encoder output toward a well-rounded normal distribution centered around zero, producing a more structured latent space and reducing overfitting. section 17.1.2

VAE latent-space workflow

An encoder produces z_mean and z_log_var, which define a latent probability distribution. A sampled latent point z is passed to the decoder, while reconstruction and regularization losses train the model. section 17.1.2

Figure 17.4 A VAE maps an image to two vectors, z_mean and z_log_var, which define a probability distribution over the latent space, used to sample a latent point to decode.
figure

Shows how a VAE maps an image to z_mean and z_log_var, defines a latent distribution, samples a latent point, and decodes it. section 17.1.2

How Deep Learning with R, Third Edition covers it

How deep it goes
Defines the training role and intended distributional effect, but does not derive the divergence mathematically.
Examples
Uses z_mean, z_log_var, latent sampling, decoding, reconstruction loss, and regularization loss as the working example.
What you can do after
Understand how distributional regularization shapes a variational autoencoder’s latent space.
How it connects
Connects variational autoencoders with latent spaces, encoder distributions, reconstruction loss, and regularization loss.

Also explained in

Compare how 12 books explain Kullback–Leibler divergence →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with R, Third Edition. The section links point to the parts of the book it draws on.