Adversarial learning with GANs, introduced by Ian Goodfellow and others in 2014, is a framework for fitting the distributions of a dataset by pairing two networks against each other in a way that one model generates examples and the others discriminate, whether they are real or not. This can help us to extend our dataset with new training examples. Semi-supervised training with GANs can help achieve higher performance in supervised tasks while using only small amounts of labeled training examples.
The focus of this recipe is implementing a Deep Convolutional Generative Adversarial Network (DCGAN) and a discriminator on the MNIST dataset, one of the best-known datasets, consisting of 60,000 digits between 0 and 9. We'll explain the terminology and background in the How it works... section.
We don't need any special libraries for this recipe. We'll use TensorFlow with Keras, NumPy, and Matplotlib, all of which we've seen earlier. For saving...