A generative adversarial network (GAN) trains two neural networks together. The generator makes samples intended to resemble the training data; the discriminator tries to tell those samples from real ones. Their competition helps the generator produce more realistic results. Unlike a discriminative model used to assign labels to inputs, the finished GAN is used to create new data. section 1.2.1 section 1.1.1
Figure 1.2 GANs architecture and its components. GANs employ a dual-network architecture comprising a generative model (left) tasked with capturing the underlying data distribution and a discriminative model (center) that serves to estimate the likelihood that a given sample originates from the authentic training dataset (considered as “real”) rather than being a product of the generative model (considered as “fake”).
Follow both paths into the discriminator: one carries training samples, and the other carries samples made by the generator. section 1.2.1
A first GAN project follows a short workflow:
- Prepare examples of the pattern to reproduce. The generated content depends on this training data. section 3.6
- Build a discriminator to classify real versus generated samples and a generator to make new samples. section 3.6
- Train the networks, decide when to stop, then discard the discriminator and use the trained generator. section 3.6
Generate a number pattern
To generate sequences of ten integers that are multiples of 5, first turn the training integers into one-hot variables the networks can use. Build and train both networks, use early stopping, then convert the generator’s output back into readable integers. The same workflow can instead learn pairs of values following an exponential growth curve. section 3.5 section 3.6
The pattern need not be numeric. Training images can lead to generated clothing or face images; a CycleGAN can instead transform an image attribute, such as changing blond hair to black hair and back. GAN projects also extend to music, where choosing a digital representation is part of preparing the data. section 1.2.1 section 1.2.3 section 13.1











