GAN C1_W3: Confused about the G and C losss minimax

I am confused about the minimax between generator and critic’s losses in C1_W3 assignment Loss section. This is the W-loss:

E(c(x)) - E(c(g(x)))

Generator minimizes and Critic maximizes. So, generator should maximize E(c(g(x))) while the critic should minimize the term. The hint provided in the notebook suggests taking negative of the critic’s score for the Generator loss. I don’t understand why and how does that minimize the loss/distance for the generator? My understanding is that the critic wants c(g(x) close to 0 and generator wants it close to 1. So, should it be 1 - c(g(x)?

It is even more confusing for the critic’s loss. It should be as straight-forward as the formula given in the course material but it fails the test.

Hi @khteh

In WGAN, the critic’s goal is to maximize the Wasserstein distance E[c(x_{real})] - E[c(g(z))], while the generator’s goal is to minimize it. That means the critic wants to give higher scores to real samples and lower scores to generated ones, and the generator tries to make the critic assign higher scores to its fake samples. Because optimizers like Adam minimize by default, we define the generator loss as the negative of the critic’s output on fake samples (-E[c(g(z))]). This way, minimizing the generator loss effectively maximizes the critic’s score for generated data.

Unlike the original GAN, the WGAN critic doesn’t output probabilities between 0 and 1, so you shouldn’t use 1 - c(g(x)). The critic’s output can be any real number, and the goal is simply to shift its mean value for fake samples upward as the generator improves.

Hope it helps! Feel free to let me know if you need further assistance.

1 Like