How Generative Adversarial Networks (GANs) work?

Generative Adversarial Networks were first introduced in 2014 in a research paper. They have also been called  “the most interesting idea in the last ten years in Machine Learning” by Yann LeCun, Facebook’s AI research director.

To understand the concept of adversarial networks, we need to understand discriminative models, based on deep learning. The discriminative models take sample input data and process them to generate groupings to identify the data. On the contrary, generative networks can produce new features based on defined conditions.

Image source: O’Reilly

Need for GANs

The discriminative networks can be error-prone due to small quantities of noise in the data. The results can be miscalculated and misleading. The primary reason behind this limitation is the way machine learning models are designed to learn. Most of them learn from the limited data, which may contain inaccurate, non-linear relationship between the input and output.

Structure of GANs

A Generative Adversarial Network contains a “generator”(G) neural network and a “discriminator”(D) neural network. The generator produces dummy data samples to mislead the discriminator. The discriminator tries to determine the difference between the dummy and real data.

The above process takes place with the following steps:

  • Random variable generation
  • Transformation of the random variable into a complex variable.
  • Generation of output random variable containing probabilities
  • the final output of the generative network

Both the neural networks compete with each other during the formative period. The training steps are performed repeatedly by both the models and they gradually get improved after several cycles.

The goal of the generative model is the maximization of the probability of the distributor being incorrect. The discriminator aims for minimization of the estimation of accuracy of the sample data.

To effectively train the GANs, consider the following points:

  • While training the discriminator, the adversary should be constant, and while training the adversary, the discriminator should be constant.
  • To avoid one network from dominating the another, both the models should have an equivalent skill threshold.

Benefits and drawbacks

The advantages of GANs involve:

  • Diminished need for direct data example inputs which can be replaced with gradients to the discriminator.
  • Ability to generate sharp distributions which are superior to the Markov chains which need the blurry distribution to achieve the correct mix.

The main drawback of the GANs is their tendency to take a lot of time for the training. It may take hours for a GAN to train, which in turn make them complex to form and use.

Note: This is a guest post, and opinion in this article is of the guest writer. If you have any issues with any of the articles posted at please contact at [email protected]