We've got a generator and a discriminator—that's all we need, right? Not so fast. We need to actually create the adversarial model. Also, there is an open ended question about why are we not focusing more on the loss function. In this case, each of the loss functions are built into the Keras library, so we aren't going to focus heavily on that aspect right now. When we cover more complex models, the loss functions will need to be customized, and that will require more explanation. For now, let's keep our focus on how to structure a basic GAN and how we can train it in an adversarial manner.
All of this code will be put into the gan.py
file under the full-gan
folder. This class represents the adversarial model portion of the model development and will allow us to put the two neural networks against each other. This recipe requires the same basic tools that you have used for the last two recipes.