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
- Sample real values and noise.
- Generate fake values.
- Train the discriminator on real vs generated samples.
- Train the generator against the discriminator.
- 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.