Answers.Body: <p>The question is about a mismatch between the loss function in two papers on GANs. The first paper is <a href="https://arxiv.org/pdf/1406.2661.pdf" rel="nofollow noreferrer"><em>Generative Adversarial Nets</em></a> Ian J. Goodfellow et. al., 2014, and the excerpt image in the question is this.</p>
  <blockquote>
  <p>The adversarial modeling framework is most straightforward to apply when the models are both multilayer perceptrons. To learn the generator’s distribution <span class="math-container">$p_g$</span> over data <span class="math-container">$x$</span>, we define a prior on input noise variables <span class="math-container">$p_z (z)$</span>, then represent a mapping to data space as <span class="math-container">$G (z; \theta_g)$</span>, where <span class="math-container">$G$</span> is a differentiable function represented by a multilayer perceptron with parameters <span class="math-container">$\theta_g$</span>. We also define a second multilayer perceptron <span class="math-container">$D (x; \theta_d)$</span> that outputs a single scalar. <span class="math-container">$D (x)$</span> represents the probability that <span class="math-container">$x$</span> came from the data rather than pg. We train <span class="math-container">$D$</span> to maximize the probability of assigning the correct label to both training examples and samples from <span class="math-container">$G$</span>. We simultaneously train <span class="math-container">$G$</span> to minimize <span class="math-container">$\log (1 − D(G(z)))$</span>:</p>
  <p>In other words, <span class="math-container">$D$</span> and <span class="math-container">$G$</span> play the following two-player minimax game with value function <span class="math-container">$V (G, D)$</span>:</p>
  <p><span class="math-container">$$ \min_G \, \max_D V (D, G) = \mathbb{E}_{x∼p_{data}(x)} \, [\log \, D(x)] \\
  \quad\quad\quad\quad\quad\quad\quad  + \, \mathbb{E}_{z∼p_z(z)} \, [\log \, (1 − D(G(z)))] \, \text{.} \quad \text{(1)} $$</span></p>
  </blockquote>
  <p>The second paper is <a href="https://arxiv.org/pdf/1611.07004.pdf" rel="nofollow noreferrer"><em>Image-to-Image Translation with Conditional Adversarial Networks</em></a>, Phillip Isola Jun-Yan Zhu Tinghui Zhou Alexei A. Efros, 2018, and the excerpt image in the question is this.</p>
  <blockquote>
  <p>The objective of a conditional GAN can be expressed as</p>
  <p><span class="math-container">$$ \mathcal{L}_{cGAN} (G, D) = \mathbb{E}_{x, y} \, [\log D(x, y)] \\ \quad\quad\quad\quad\quad\quad\quad + \mathbb{E}_{x, z} \, [\log \, (1 − D(x, G(x, z))], \quad \text{(1)} $$</span></p>
  <p>where <span class="math-container">$G$</span> tries to minimize this objective against an adversarial <span class="math-container">$D$</span> that tries to maximize it, i.e.</p>
  <p><span class="math-container">$$ G^{∗} = \arg \, \min_G \, \max_D \mathcal{L}_{cGAN} (G, D) \, \text{.} $$</span></p>
  <p>To test the importance of conditioning the discriminator, we also compare to an unconditional variant in which the discriminator does not observe <span class="math-container">$x$</span>:</p>
  <p><span class="math-container">$$ \mathcal{L}_{GAN} (G, D) = \mathbb{E}_y \, [\log \, D(y)] \\
  \quad\quad\quad\quad\quad\quad\quad + \mathbb{E}_{x, z} \, [\log \, (1 − D(G(x, z))] \, \text{.} \quad \text{(2)} $$</span></p>
  </blockquote>
  <p>In the above <span class="math-container">$G$</span> refers to the generative network, <span class="math-container">$D$</span> refers to the discriminative network, and <span class="math-container">$G^{*}$</span> refers to the minimum with respect to <span class="math-container">$G$</span> of the maximum with respect to <span class="math-container">$D$</span>. As the question author tentatively put forward, <span class="math-container">$\mathbb{E}$</span> is the expectation with respect to its subscripts.</p>
  <p>The question of discrepancy is that the right hand sides do not match between the first paper's equation (1) and the second paper's equation (2) which is absent of the condition involving <span class="math-container">$y$</span>.</p>
  <p>First paper:</p>
  <p><span class="math-container">$$ \mathbb{E}_{x∼p_{data}(x)} \, [\log \, D(x)] \\
  \quad\quad\quad\quad\quad\quad\quad  + \, \mathbb{E}_{z∼p_z(z)} \, [\log \, (1 − D(G(z)))] \, \text{.} \quad \text{(1)} $$</span></p>
  <p>Second paper:</p>
  <p><span class="math-container">$$ \mathbb{E}_y \, [\log \, D(y)] \\
  \quad\quad\quad\quad\quad\quad\quad + \mathbb{E}_{x, z} \, [\log \, (1 − D(G(x, z))] \, \text{.} \quad \text{(2)} $$</span></p>
  <p>The second later paper further states this.</p>
  <blockquote>
  <p>GANs are generative models that learn a mapping from random noise vector <span class="math-container">$z$</span> to output image <span class="math-container">$y, G : z \rightarrow y$</span>. In contrast, conditional GANs learn a mapping from observed image <span class="math-container">$x$</span> and random noise vector <span class="math-container">$z$</span>, to <span class="math-container">$y, G : {x, z} \rightarrow y$</span>.</p>
  </blockquote>
  <p>Notice that there is no <span class="math-container">$y$</span> in the first paper and the removal of the condition in the second paper corresponds to the removal of <span class="math-container">$x$</span> as the first parameter of <span class="math-container">$D$</span>. This is one of the causes of confusion when comparing the right hand sides. The others are use of variables and degree of explicitness in notation.</p>
  <p>The tilda <span class="math-container">$~$</span> means <em>drawn according to</em>. The right hand side in the first paper indicates that the expectation involving <span class="math-container">$x$</span> is based on a drawing according to the probability distribution of the data with respect to <span class="math-container">$x$</span> and the expectation involving <span class="math-container">$z$</span> is based on a drawing according to the probability distribution of <span class="math-container">$z$</span> with respect to <span class="math-container">$z$</span>.</p>
  <p>The removal of the observation of <span class="math-container">$x$</span> from the second right hand term of the second paper's equation (2), which is the first parameter of <span class="math-container">$G$</span>, the replacement of that equation's <span class="math-container">$y$</span> variable with the now freed up <span class="math-container">$x$</span> variable, and the acceptance of the abbreviation of the tilda notation used in the first paper then brings both papers into exact agreement.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-25T10:39:17.463Z
Answers.Text: Thank you for your reply and sorry for the late response. Regarding this paragraph: "The question of discrepancy is that the right hand sides do not match between the first paper's equation (1) and the second paper's equation (2) which is absent of the condition involving ." No, it is not what confuses me. The question of discrepancy is the mismatch of the left hand sides of the 2 papers: the first paper defines the Expectations to be the results of the min-max operation, where as the second paper suggests to take the min-max of the Expections.
Answers.UserDisplayName: AugLe
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-25T14:40:13.367Z
Answers.LastActivityDate: 2019-01-25T14:40:13.367Z
Answers.LastEditDate: 2020-06-17T09:57:20.710Z
Answers.UserDisplayName: Douglas Daseeco
Answers.Body: <p>What is meant by both papers is that we have two agents (generator and discriminator) playing a game with the value function <code>V</code> defined as a sum of the expectations (i.e. an expectation of the outcome value defined as a sum of two terms, or actually a logarithm of a product...). The generator uses a strategy <code>G</code> encoded in the parameters of its neural network (<code>θg</code>), the discriminator uses a strategy <code>D</code> encoded in the parameters of its neural network (<code>θd</code>). Our goal is to (hopefully) find such a pair of strategies (a pair of parameter sets <code>θgmin</code> and <code>θdmax</code>) that produce the minimax value.</p>
  
  <p>While trying to find the (<code>θgmin</code>, <code>θdmax</code>) pair using gradient descent, we actually have two loss functions: one is the loss function for <code>G</code>, parameterized by <code>θg</code>, another is the loss function for <code>D</code>, parameterized by <code>θd</code>, and we train them alternatively on minibatches together.</p>
  
  <p>If you look at the Algorithm 1 in the original paper, the loss function for the discriminator is <code>-log(D(x; θd)) - log(1 - D(G(z); θd)</code>, and the loss function for the generator is <code>log(1 - D(G(z; θg))</code> (in both cases, in the original paper, <code>x</code> is sampled from the reference data distribution and <code>z</code> is sampled from noise):</p>
  
  <p>The ideal value for the loss function of the discriminator is 0, otherwise it's greater than 0. The "loss" function of the generator is actually negative, but, for better gradient descent behavior, can be replaced with <code>-log(D(G(z; θg))</code>, which also has the ideal value for the generator at 0. It is impossible to reach zero loss for both generator and discriminator in the same GAN at the same time. However, the idea of the GAN is not to reach zero loss for any of the game agents (this is actually counterproductive), but to use that "double gradient descent" to "converge" the distribution of <code>G(z)</code> to the distribution of <code>x</code>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-15T10:05:01.620Z
Answers.Text: Thanks for your reply. Yet, I am more concerned of the whole equations themselves. The pix2pix paper wants to minimize the expectation while the GAN paper shows that the expectation is the result of the minimization.
Answers.UserDisplayName: AugLe
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-15T10:37:17.460Z
Answers.Text: Yes, and they are different that one is defined to be the min of max of expectation (pix2pix) while the other is defined as the min of max of value function (GAN paper). Does that make sense?
Answers.UserDisplayName: AugLe
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-17T11:04:38.930Z
Answers.Text: So let me rephrase the question like this: what is the target function to be optimize for a general GAN? In the GAN paper, Goodfellow uses $V(D, G)$, but what is $V(D, G)$ exactly? Is it $V(D,G) = E(\log(D(y)) + E(1-\log(D(G(x, z))$
Answers.UserDisplayName: AugLe
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-17T20:39:58.400Z
Answers.Text: @AugLe Edited again. Hopefully now it's clearer what is actually optimized in GANs.
Answers.UserDisplayName: Kit.
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-15T00:46:39.527Z
Answers.LastActivityDate: 2019-01-21T09:29:37.157Z
Answers.LastEditDate: 2019-01-21T09:29:37.157Z
Answers.UserDisplayName: Kit.
Answers.Body: <p>I'm not sure I understand your question. However responding to your question in the comments. The difference between the two objectives is that:</p>
  
  <p>In an ordinary GAN, we want to push <span class="math-container">$p(G)$</span> to be as close as possible to <span class="math-container">$p(data)$</span></p>
  
  <p>In a conditional GAN, we have a context <span class="math-container">$c$</span>. If we imagine for ease of understanding that <span class="math-container">$c=[1,2,3]$</span> is a discrete variable where all the data can be categorised under one of these c values , then we want to:
   push <span class="math-container">$p(G|c=1)$</span> as close as possible to <span class="math-container">$p(data|c=1)$</span>
  push <span class="math-container">$p(G|c=2)$</span> as close as possible to <span class="math-container">$p(data|c=2)$</span>
  push <span class="math-container">$p(G|c=3)$</span> as close as possible to <span class="math-container">$p(data|c=3)$</span></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-21T17:36:39.007Z
Answers.LastActivityDate: 2019-01-21T17:36:39.007Z
Answers.UserDisplayName: piccolo
Body: <p>I was trying to understand the loss function of GANs, but I found a little mismatch between different papers.</p>
  <p>This is taken from <a href="https://arxiv.org/pdf/1406.2661.pdf" rel="nofollow noreferrer">the original GAN paper</a>:</p>
  <blockquote>
  <p>The adversarial modeling framework is most straightforward to apply when the models are both multilayer perceptrons. To learn the generator's distribution <span class="math-container">$p_{g}$</span> over data <span class="math-container">$\boldsymbol{x}$</span>, we define a prior on input noise variables <span class="math-container">$p_{\boldsymbol{z}}(\boldsymbol{z})$</span>, then represent a mapping to data space as <span class="math-container">$G\left(\boldsymbol{z} ; \theta_{g}\right)$</span>, where <span class="math-container">$G$</span> is a differentiable function represented by a multilayer perceptron with parameters <span class="math-container">$\theta_{g} .$</span> We also define a second multilayer perceptron <span class="math-container">$D\left(\boldsymbol{x} ; \theta_{d}\right)$</span> that outputs a single scalar. <span class="math-container">$D(\boldsymbol{x})$</span> represents the probability that <span class="math-container">$\boldsymbol{x}$</span> came from the data rather than <span class="math-container">$p_{g}$</span>. We train <span class="math-container">$D$</span> to maximize the probability of assigning the correct label to both training examples and samples from <span class="math-container">$G$</span>. We simultaneously train <span class="math-container">$G$</span> to minimize <span class="math-container">$\log (1-D(G(\boldsymbol{z})))$</span> :</p>
  <p>In other words, <span class="math-container">$D$</span> and <span class="math-container">$G$</span> play the following two-player minimax game with value function <span class="math-container">$V(G, D)$</span> :</p>
  </blockquote>
  <p><span class="math-container">$$
  \min _{G} \max _{D} V(D, G)=\mathbb{E}_{\boldsymbol{x} \sim p_{\text {data }}(\boldsymbol{x})}[\log D(\boldsymbol{x})]+\mathbb{E}_{\boldsymbol{z} \sim p_{\boldsymbol{z}}(\boldsymbol{z})}[\log (1-D(G(\boldsymbol{z})))]
  $$</span></p>
  <p>Equation (1) in this version of <a href="https://arxiv.org/pdf/1611.07004.pdf" rel="nofollow noreferrer">the pix2pix paper</a></p>
  <blockquote>
  <p>The objective of a conditional GAN can be expressed as
  <span class="math-container">$$
  \begin{aligned}
  \mathcal{L}_{c G A N}(G, D)=&amp; \mathbb{E}_{x, y}[\log D(x, y)]+\\
  &amp; \mathbb{E}_{x, z}[\log (1-D(x, G(x, z))],
  \end{aligned}
  $$</span>
  where <span class="math-container">$G$</span> tries to minimize this objective against an adversarial <span class="math-container">$D$</span> that tries to maximize it, i.e. <span class="math-container">$G^{*}=$</span> <span class="math-container">$\arg \min _{G} \max _{D} \mathcal{L}_{c G A N}(G, D)$</span>.</p>
  <p>To test the importance of conditioning the discriminator, we also compare to an unconditional variant in which the discriminator does not observe <span class="math-container">$x$</span> :
  <span class="math-container">$$
  \begin{aligned}
  \mathcal{L}_{G A N}(G, D)=&amp; \mathbb{E}_{y}[\log D(y)]+\\
  &amp; \mathbb{E}_{x, z}[\log (1-D(G(x, z))] .
  \end{aligned}
  $$</span></p>
  </blockquote>
  <p>Putting aside the fact that pix2pix is using conditional GAN, which introduces a second term <span class="math-container">$y$</span>, the 2 formulas are quite resemble, except that in the pix2pix paper, they try to get minimax of <span class="math-container">${\cal{L}}_{cGAN}(G, D)$</span>, which is defined to be <span class="math-container">$E_{x,y}[...] + E_{x,z}[...]$</span>, whereas in the original paper, they define <span class="math-container">$\min\max V(G, D) = E[...] + E[...]$</span>.</p>
  <p>I am not coming from a good math background, so I am quite confused. I'm not sure where the mistake is, but assuming that <span class="math-container">$E$</span> is expectation (correct me if I'm wrong), the version in pix2pix makes more sense to me, although I think it's quite less likely that Goodfellow could make this mistake in his amazing paper. Maybe there's no mistake at all and it's me who do not understand them correctly.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-12-09T09:25:25.670Z
Comments.Text: What mistake were you talking about? I don't understand which mistake you're referring to from you description.
Comments.UserDisplayName: nbro
Tags: <neural-networks><deep-learning><papers><generative-model>
Title: Mismatch between the definition of the GAN loss function in two papers
UserDisplayName: AugLe
ThreadText: # Mismatch between the definition of the GAN loss function in two papers
  
  (Asked by: username_0 on 2019-01-14)
  
  I was trying to understand the loss function of GANs, but I found a little mismatch between different papers.
  
  This is taken from [the original GAN paper](https://arxiv.org/pdf/1406.2661.pdf):
  
  > The adversarial modeling framework is most straightforward to apply when the models are both multilayer perceptrons. To learn the generator's distribution $p\_{g}$ over data $\boldsymbol{x}$, we define a prior on input noise variables $p\_{\boldsymbol{z}}(\boldsymbol{z})$, then represent a mapping to data space as $G\left(\boldsymbol{z} ; \theta\_{g}\right)$, where $G$ is a differentiable function represented by a multilayer perceptron with parameters $\theta\_{g} .$ We also define a second multilayer perceptron $D\left(\boldsymbol{x} ; \theta\_{d}\right)$ that outputs a single scalar. $D(\boldsymbol{x})$ represents the probability that $\boldsymbol{x}$ came from the data rather than $p\_{g}$. We train $D$ to maximize the probability of assigning the correct label to both training examples and samples from $G$. We simultaneously train $G$ to minimize $\log (1-D(G(\boldsymbol{z})))$ :
  >
  > In other words, $D$ and $G$ play the following two-player minimax game with value function $V(G, D)$ :
  
  $$
  \min \_{G} \max \_{D} V(D, G)=\mathbb{E}\_{\boldsymbol{x} \sim p\_{\text {data }}(\boldsymbol{x})}[\log D(\boldsymbol{x})]+\mathbb{E}\_{\boldsymbol{z} \sim p\_{\boldsymbol{z}}(\boldsymbol{z})}[\log (1-D(G(\boldsymbol{z})))]
  $$
  
  Equation (1) in this version of [the pix2pix paper](https://arxiv.org/pdf/1611.07004.pdf)
  
  > The objective of a conditional GAN can be expressed as
  > $$
  > \begin{aligned}
  > \mathcal{L}\_{c G A N}(G, D)=& \mathbb{E}\_{x, y}[\log D(x, y)]+\\
  > & \mathbb{E}\_{x, z}[\log (1-D(x, G(x, z))],
  > \end{aligned}
  > $$
  > where $G$ tries to minimize this objective against an adversarial $D$ that tries to maximize it, i.e. $G^{\*}=$ $\arg \min \_{G} \max \_{D} \mathcal{L}\_{c G A N}(G, D)$.
  >
  > To test the importance of conditioning the discriminator, we also compare to an unconditional variant in which the discriminator does not observe $x$ :
  > $$
  > \begin{aligned}
  > \mathcal{L}\_{G A N}(G, D)=& \mathbb{E}\_{y}[\log D(y)]+\\
  > & \mathbb{E}\_{x, z}[\log (1-D(G(x, z))] .
  > \end{aligned}
  > $$
  
  Putting aside the fact that pix2pix is using conditional GAN, which introduces a second term $y$, the 2 formulas are quite resemble, except that in the pix2pix paper, they try to get minimax of ${\cal{L}}\_{cGAN}(G, D)$, which is defined to be $E\_{x,y}[...] + E\_{x,z}[...]$, whereas in the original paper, they define $\min\max V(G, D) = E[...] + E[...]$.
  
  I am not coming from a good math background, so I am quite confused. I'm not sure where the mistake is, but assuming that $E$ is expectation (correct me if I'm wrong), the version in pix2pix makes more sense to me, although I think it's quite less likely that Goodfellow could make this mistake in his amazing paper. Maybe there's no mistake at all and it's me who do not understand them correctly.
  
  **Tags:** neural-networks, deep-learning, papers, generative-model
  
  > **Comments:**
  > **username_1**: What mistake were you talking about? I don't understand which mistake you're referring to from you description.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_2 on 2019-01-25. Score: 1
  
  The question is about a mismatch between the loss function in two papers on GANs. The first paper is [*Generative Adversarial Nets*](https://arxiv.org/pdf/1406.2661.pdf) Ian J. Goodfellow et. al., 2014, and the excerpt image in the question is this.
  
  > The adversarial modeling framework is most straightforward to apply when the models are both multilayer perceptrons. To learn the generator’s distribution $p\_g$ over data $x$, we define a prior on input noise variables $p\_z (z)$, then represent a mapping to data space as $G (z; \theta\_g)$, where $G$ is a differentiable function represented by a multilayer perceptron with parameters $\theta\_g$. We also define a second multilayer perceptron $D (x; \theta\_d)$ that outputs a single scalar. $D (x)$ represents the probability that $x$ came from the data rather than pg. We train $D$ to maximize the probability of assigning the correct label to both training examples and samples from $G$. We simultaneously train $G$ to minimize $\log (1 − D(G(z)))$:
  >
  > In other words, $D$ and $G$ play the following two-player minimax game with value function $V (G, D)$:
  >
  > $$ \min\_G \, \max\_D V (D, G) = \mathbb{E}\_{x∼p\_{data}(x)} \, [\log \, D(x)] \\
  > \quad\quad\quad\quad\quad\quad\quad + \, \mathbb{E}\_{z∼p\_z(z)} \, [\log \, (1 − D(G(z)))] \, \text{.} \quad \text{(1)} $$
  
  The second paper is [*Image-to-Image Translation with Conditional Adversarial Networks*](https://arxiv.org/pdf/1611.07004.pdf), Phillip Isola Jun-Yan Zhu Tinghui Zhou Alexei A. Efros, 2018, and the excerpt image in the question is this.
  
  > The objective of a conditional GAN can be expressed as
  >
  > $$ \mathcal{L}\_{cGAN} (G, D) = \mathbb{E}\_{x, y} \, [\log D(x, y)] \\ \quad\quad\quad\quad\quad\quad\quad + \mathbb{E}\_{x, z} \, [\log \, (1 − D(x, G(x, z))], \quad \text{(1)} $$
  >
  > where $G$ tries to minimize this objective against an adversarial $D$ that tries to maximize it, i.e.
  >
  > $$ G^{∗} = \arg \, \min\_G \, \max\_D \mathcal{L}\_{cGAN} (G, D) \, \text{.} $$
  >
  > To test the importance of conditioning the discriminator, we also compare to an unconditional variant in which the discriminator does not observe $x$:
  >
  > $$ \mathcal{L}\_{GAN} (G, D) = \mathbb{E}\_y \, [\log \, D(y)] \\
  > \quad\quad\quad\quad\quad\quad\quad + \mathbb{E}\_{x, z} \, [\log \, (1 − D(G(x, z))] \, \text{.} \quad \text{(2)} $$
  
  In the above $G$ refers to the generative network, $D$ refers to the discriminative network, and $G^{\*}$ refers to the minimum with respect to $G$ of the maximum with respect to $D$. As the question author tentatively put forward, $\mathbb{E}$ is the expectation with respect to its subscripts.
  
  The question of discrepancy is that the right hand sides do not match between the first paper's equation (1) and the second paper's equation (2) which is absent of the condition involving $y$.
  
  First paper:
  
  $$ \mathbb{E}\_{x∼p\_{data}(x)} \, [\log \, D(x)] \\
  \quad\quad\quad\quad\quad\quad\quad + \, \mathbb{E}\_{z∼p\_z(z)} \, [\log \, (1 − D(G(z)))] \, \text{.} \quad \text{(1)} $$
  
  Second paper:
  
  $$ \mathbb{E}\_y \, [\log \, D(y)] \\
  \quad\quad\quad\quad\quad\quad\quad + \mathbb{E}\_{x, z} \, [\log \, (1 − D(G(x, z))] \, \text{.} \quad \text{(2)} $$
  
  The second later paper further states this.
  
  > GANs are generative models that learn a mapping from random noise vector $z$ to output image $y, G : z \rightarrow y$. In contrast, conditional GANs learn a mapping from observed image $x$ and random noise vector $z$, to $y, G : {x, z} \rightarrow y$.
  
  Notice that there is no $y$ in the first paper and the removal of the condition in the second paper corresponds to the removal of $x$ as the first parameter of $D$. This is one of the causes of confusion when comparing the right hand sides. The others are use of variables and degree of explicitness in notation.
  
  The tilda $~$ means *drawn according to*. The right hand side in the first paper indicates that the expectation involving $x$ is based on a drawing according to the probability distribution of the data with respect to $x$ and the expectation involving $z$ is based on a drawing according to the probability distribution of $z$ with respect to $z$.
  
  The removal of the observation of $x$ from the second right hand term of the second paper's equation (2), which is the first parameter of $G$, the replacement of that equation's $y$ variable with the now freed up $x$ variable, and the acceptance of the abbreviation of the tilda notation used in the first paper then brings both papers into exact agreement.
  
  > **Comments:**
  > **username_0**: Thank you for your reply and sorry for the late response. Regarding this paragraph: "The question of discrepancy is that the right hand sides do not match between the first paper's equation (1) and the second paper's equation (2) which is absent of the condition involving ." No, it is not what confuses me. The question of discrepancy is the mismatch of the left hand sides of the 2 papers: the first paper defines the Expectations to be the results of the min-max operation, where as the second paper suggests to take the min-max of the Expections.  
  
  ---
  
  ### Answer by username_3 on 2019-01-15. Score: 0
  
  What is meant by both papers is that we have two agents (generator and discriminator) playing a game with the value function `V` defined as a sum of the expectations (i.e. an expectation of the outcome value defined as a sum of two terms, or actually a logarithm of a product...). The generator uses a strategy `G` encoded in the parameters of its neural network (`θg`), the discriminator uses a strategy `D` encoded in the parameters of its neural network (`θd`). Our goal is to (hopefully) find such a pair of strategies (a pair of parameter sets `θgmin` and `θdmax`) that produce the minimax value.
  
  While trying to find the (`θgmin`, `θdmax`) pair using gradient descent, we actually have two loss functions: one is the loss function for `G`, parameterized by `θg`, another is the loss function for `D`, parameterized by `θd`, and we train them alternatively on minibatches together.
  
  If you look at the Algorithm 1 in the original paper, the loss function for the discriminator is `-log(D(x; θd)) - log(1 - D(G(z); θd)`, and the loss function for the generator is `log(1 - D(G(z; θg))` (in both cases, in the original paper, `x` is sampled from the reference data distribution and `z` is sampled from noise):
  
  The ideal value for the loss function of the discriminator is 0, otherwise it's greater than 0. The "loss" function of the generator is actually negative, but, for better gradient descent behavior, can be replaced with `-log(D(G(z; θg))`, which also has the ideal value for the generator at 0. It is impossible to reach zero loss for both generator and discriminator in the same GAN at the same time. However, the idea of the GAN is not to reach zero loss for any of the game agents (this is actually counterproductive), but to use that "double gradient descent" to "converge" the distribution of `G(z)` to the distribution of `x`.
  
  > **Comments:**
  > **username_0**: Thanks for your reply. Yet, I am more concerned of the whole equations themselves. The pix2pix paper wants to minimize the expectation while the GAN paper shows that the expectation is the result of the minimization.  
  > **username_0**: Yes, and they are different that one is defined to be the min of max of expectation (pix2pix) while the other is defined as the min of max of value function (GAN paper). Does that make sense?  
  > **username_0**: So let me rephrase the question like this: what is the target function to be optimize for a general GAN? In the GAN paper, Goodfellow uses $V(D, G)$, but what is $V(D, G)$ exactly? Is it $V(D,G) = E(\log(D(y)) + E(1-\log(D(G(x, z))$  
  > **username_3**: @username_0 Edited again. Hopefully now it's clearer what is actually optimized in GANs.  
  
  ---
  
  ### Answer by username_4 on 2019-01-21. Score: -1
  
  I'm not sure I understand your question. However responding to your question in the comments. The difference between the two objectives is that:
  
  In an ordinary GAN, we want to push $p(G)$ to be as close as possible to $p(data)$
  
  In a conditional GAN, we have a context $c$. If we imagine for ease of understanding that $c=[1,2,3]$ is a discrete variable where all the data can be categorised under one of these c values , then we want to:
  push $p(G|c=1)$ as close as possible to $p(data|c=1)$
  push $p(G|c=2)$ as close as possible to $p(data|c=2)$
  push $p(G|c=3)$ as close as possible to $p(data|c=3)$
  
  
  ---
  
  