Generative Adversarial networks (GANs): A step to AI Algorithms

Generative Adversarial networks (GANs): A step to AI Algorithms

“Time flies like an arrow; fruit flies like a banana” is one of the best quotes to conceive the growth of science and technology in today’s world. There is no denying that science doesn’t keep the lid on the inventions and discoveries only; however, it zooms in the survival of the fittest in this living world.

Keeping in line, let’s shift the limelight to Artificial intelligence. John McCarthy introduced it to the world as “the science and engineering of making intelligent machines.” Alternatively, in other words, it can be defined as the capability of machines to mimic human intelligence including visual perception or speech recognition.


In today’s day and age, we all know innumerable ways to simulate intelligent human behavior. However, in this post, we are talking about Generative Adversarial networks (GANs), which entitled as “the most interesting idea in the last ten years in ML” by Yann LeCun, Facebook AI research director. Hoping this tagline is enough to advertise the selected topic and the worth of reading it.


GAN came into existence soon after its publishing in the paper by Ian Goodfellow and other researchers at the University of Montreal in 2014. Their target is to create the impressive mimics of the real world in every niche or domains.

By definition, GANs are neural net architecture, comprising two circuits of neurons which play off each other thus, called adversarial networks. Still, the essence of generative is missing in the definition. To understand that, let’s take it a step further. GANs beautifully represent the real-time conceptual progress for Generative models in the simplest way.


Let’s understand both neural networks, generative and discriminative algorithm together for better clarity. Have you ever got spam emails? Of course yes, however here the question is do you know how to use algorithms for labelling the data to its respective group.


So for instance, we have an email, and all words put there are features (the data instance), and spam or not spam is our labels. In discriminative algorithm ‘x’ denotes features, and ‘y’ denotes label. By using mathematical formulation P(y/x), we can predict whether the email is spam or not. And in words, P(y/x) can be written as ‘the probability of y given x.’  So, for given example, the representation becomes ‘the probability that the given email is spam given the bag of words it includes.’

On the contrary, the mathematical formulation for the generative algorithm is P(x/y), and in words, it is ‘the probability of features given a label’ in words.

So, in short, discriminative deals in ‘checking the authenticity of the relation between x and y’ whereas generative algorithm search for ‘how to get x and generate new features.’

CycleGANs, CartoonGANs, CariGANs are some of its applications which are in great use for transferring characteristic of one image to another, transforming real-time photos into cartoon-style images, and photo-to-caricature translation respectively.


The following is the step-by-step guide for working of GANs,

  1. Generator tries to create an authentic looking image according to the training data.
  2. Discriminator receives the generated image along with the real data set. It evaluates both and then displays the result for fake or authentic.
  3. We then connect the generator and the discriminator to produce a GAN.

To get into the technicalities, the discriminator has to tell the generator how to tweak the pixels for better and more realistic results. As generator improves, the discriminator too can be improved to better distinguish real and generated fakes. This is how the GANs are trained.


One thing, which can surely be concluded that GANs are being researched and built even while you are reading this. So, GANs do work! To find out more about them and how it can benefit you, get in touch with us over at Avyuct.


Write a Reply or Comment