What is a GAN?
Before reading this post, it is helpful to understand what a neural Network is. Please see the following if you need a refresher:
Before describing how a Generative Adversarial Network (GAN) works, let us start with the goal, which is to create a network that can generate outputs that are indistinguishable from the given set of real objects. We will call the network that produces these outputs the generator network. However, we also need something that can distinguish between the actual objects and the generated objects, which we will call the discriminator network. This network provides feedback to the generator to let it know which outputs are closest to the actual.
Imagine we have a set of keys and we want a lock that can be opened by as many of those keys as possible and as few keys as possible that are not in that original set. A locksmith starts working on making that lock. At the same time, we have a key-maker creating keys to attempt to open the lock made by the locksmith. As the key-maker gets better, the locksmith will also have to get better at distinguishing between the real and fake keys. As they continue to improve, what started off as the key-maker making random keys will eventually become keys that are similar to the original set of keys. In this example the locksmith is the discriminator, trying to reduce the number of errors, both positive and negative and the key-maker is the generator, creating keys that will try to open the lock.
The important thing to keep in mind, as with any network, is what the input looks like and what the output looks like. These two networks must work in tandem with the generator creating an output that is able to be consumed by the discriminator; this would be the key-maker making a key in the previous analogy. The discriminator, on the other hand, must be able to accept the initial set of objects and the output of the generator (the lock accepting the key) and output a binary, True/False result based on the given input (whether the key opens the lock). This only leaves the input for the generator, which is generally just a random vector to allow for variety within the generator network, the shape of which is not all that important.
GANs can be used to recreate any type of matrix, but in general they are used to create images. Images can easily be represented in matrix form by seperating each color layer into a seperate, equally sized matrix, with the intensity of that color represented by a numeric value.