Generative Models · Advanced

Generative Adversarial Network

Watch a tiny generator and discriminator compete without hiding adversarial training behind a black box.

A deliberately small 1D GAN teaches the two-player optimization mechanism without loading a heavyweight image model.

Step by step

  1. Sample real values and noise.
  2. Generate fake values.
  3. Train the discriminator on real vs generated samples.
  4. Train the generator against the discriminator.
  5. Repeat alternating updates and inspect both losses.

Core formulas

Discriminator loss

L_D = −E[log D(x)] − E[log(1−D(G(z)))]

The discriminator learns to separate real and generated samples.

Generator loss

L_G = −E[log D(G(z))]

The generator learns to make samples score as real-like.

When to use Generative Adversarial Network

  • Understanding adversarial generative learning.

Official documentation

Generative Adversarial Nets

TensorFlow DCGAN tutorial