Answers.Body: <p>To train a GAN you need only 2 networks, the generator and discriminator, none of which require to be an encoder. You also don't require synthetic data, those are generated by the generator network, you need instead <strong>real</strong> data.</p>
  <p><em>&quot;This force the generator to mimic a distribution given by the synthetic data, thus creating a latent space similar the fake data&quot;</em></p>
  <p>We're not interested in mimic synthetic data, what a GAN is suppose to learn is to generate data that follow a similar distribution of some real data. So initially the generator will create only noise, if the training is successful then the data generated by the generator should become closer and closer, eventually indistinguishable from the real data. Also, there's no requirements regarding to the latent space, even though it's true that GANs can be trained to learn latent spaces with specific property to control the features of the generated images in a similar fashion to VAE.</p>
  <p>The power of GANs when compared to VAEs is that on the paper they can map any kind of distribution to any other kind of distribution. This is possible cause rather than using a single loss that compare a network output to a ground truth label, GANs use two losses combined that mimic a distance between distributions. The combined loss nowhere include a direct comparison of the generated images with a target. Rather it just leverage the discriminator to compute how far (in terms of probability distributions) the generated and real images are.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-03T07:08:26.827Z
Answers.LastActivityDate: 2022-08-03T07:08:26.827Z
Answers.UserDisplayName: Edoardo Guerriero
Body: <p>From what I understand, a Generative Adversarial Network (GAN) is composed of an encoder (generator), some synthetic data (fake data) and a discriminator that will penalize any distinguishable real data from the fake ones. This will result in 2 training phases where one tries to beat the other one and vice versa.</p>
  <p>This force the generator to mimic a distribution given by the synthetic data, thus creating a latent space similar the fake data.</p>
  <p>However, in Variational Autoencoders (VAE), the usual loss function also includes a penalty in the latent space when the data do not follow a normal distribution. From what I've learned, this also strongly encourages the latent space to follow a normal distribution.</p>
  <p>My question is how does the penalty in the VAE is different from training a whole new network, the discriminator, that in the end penalize the generator for not following the synthetic data distribution?</p>
  <p>More generally, is it similar to penalize a wrong latent space distribution directly in the model's loss function than it is with a discriminator network?</p>
  <p>Maybe it's easier with GAN to make new distributions, at the cost of training another network, than it is to model an adapted loss function. (?)</p>
  
Tags: <objective-functions><generative-adversarial-networks><variational-autoencoder>
Title: Is the discriminator of a GAN network embedded in VAE?
UserDisplayName: Rhesus
ThreadText: # Is the discriminator of a GAN network embedded in VAE?
  
  (Asked by: username_0 on 2022-08-02)
  
  From what I understand, a Generative Adversarial Network (GAN) is composed of an encoder (generator), some synthetic data (fake data) and a discriminator that will penalize any distinguishable real data from the fake ones. This will result in 2 training phases where one tries to beat the other one and vice versa.
  
  This force the generator to mimic a distribution given by the synthetic data, thus creating a latent space similar the fake data.
  
  However, in Variational Autoencoders (VAE), the usual loss function also includes a penalty in the latent space when the data do not follow a normal distribution. From what I've learned, this also strongly encourages the latent space to follow a normal distribution.
  
  My question is how does the penalty in the VAE is different from training a whole new network, the discriminator, that in the end penalize the generator for not following the synthetic data distribution?
  
  More generally, is it similar to penalize a wrong latent space distribution directly in the model's loss function than it is with a discriminator network?
  
  Maybe it's easier with GAN to make new distributions, at the cost of training another network, than it is to model an adapted loss function. (?)
  
  **Tags:** objective-functions, generative-adversarial-networks, variational-autoencoder
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-08-03. Score: 1 | Accepted answer
  
  To train a GAN you need only 2 networks, the generator and discriminator, none of which require to be an encoder. You also don't require synthetic data, those are generated by the generator network, you need instead **real** data.
  
  *"This force the generator to mimic a distribution given by the synthetic data, thus creating a latent space similar the fake data"*
  
  We're not interested in mimic synthetic data, what a GAN is suppose to learn is to generate data that follow a similar distribution of some real data. So initially the generator will create only noise, if the training is successful then the data generated by the generator should become closer and closer, eventually indistinguishable from the real data. Also, there's no requirements regarding to the latent space, even though it's true that GANs can be trained to learn latent spaces with specific property to control the features of the generated images in a similar fashion to VAE.
  
  The power of GANs when compared to VAEs is that on the paper they can map any kind of distribution to any other kind of distribution. This is possible cause rather than using a single loss that compare a network output to a ground truth label, GANs use two losses combined that mimic a distance between distributions. The combined loss nowhere include a direct comparison of the generated images with a target. Rather it just leverage the discriminator to compute how far (in terms of probability distributions) the generated and real images are.
  
  
  ---
  
  