EbookQA
ProcessAdvanced

How does the contrastive divergence loss function work in the training step of the EBM model?

The contrastive divergence loss function in the training of an Energy-Based Model (EBM) works by calculating the difference between the scores of fake and real observations. The real images are slightly perturbed with noise, and fake images are sampled from a buffer. The loss function includes a regularization term to prevent the scores from becoming too large. Gradients of this loss function are used to update the model's weights through backpropagation.

In the training step of an Energy-Based Model (EBM) using contrastive divergence, the model first perturbs real images with a small amount of noise to prevent overfitting. Fake images are sampled from a buffer, which includes both newly generated random noise and previously sampled images. The model computes scores for both real and fake images. The contrastive divergence loss is the difference between the average scores of fake and real images. Additionally, a regularization loss is added to the total loss to keep the scores from becoming excessively large. This combined loss is used to compute gradients, which are then applied to update the model's weights via backpropagation. This process helps the model learn to distinguish between real and fake images more effectively over time.

Key points

  • Contrastive divergence loss is the difference between scores of fake and real images.
  • Real images are perturbed with noise to avoid overfitting.
  • Fake images are sampled from a buffer, including random noise and previous samples.
  • A regularization term is added to the loss to control score magnitudes.
  • Gradients of the loss function are used to update model weights.
  • The process helps the model improve its ability to distinguish real from fake images.
Source:Generative Deep Learning: Teaching Machines to Paint, Write, Compose, and Play· Energy-Based Models· p. 226–232

Related questions

Cover of Generative Deep Learning: Teaching Machines to Paint, Write, Compose, and Play

Generative Deep Learning: Teaching Machines to Paint, Write, Compose, and Play

David Foster;

Second Edition · O’Reilly Media, Inc.

View this ebook