Course contentsShow
← Machine Learning and Deep Learning
Lesson 1473 of 3,53833. Generative Adversarial NetworksFree lesson

The GAN Objective Function

Mathematical formulation of the minimax objective and what each network is trying to optimize.

The GAN Objective Function

What you'll learn: You'll understand the mathematical formulation that defines the adversarial game between generator and discriminator in GANs.

The Mathematical Heart of GANs

The GAN objective function is a minimax game expressed mathematically. The discriminator tries to maximize its ability to correctly classify real vs fake data, while the generator tries to minimize the discriminator's success—hence "minimax."

Here's the formal objective:

min_G max_D V(D, G) = E[log D(x)] + E[log(1 - D(G(z)))]

Let's break this down in plain English:

What Each Part Means

First term: E[log D(x)]

  • The discriminator's score on real data
  • D wants to maximize this (make D(x) close to 1)
  • The generator doesn't control this term directly

Second term: E[log(1 - D(G(z)))]

  • The discriminator's score on fake data G(z)
  • D wants to maximize this (make D(G(z)) close to 0, so log(1-0) is high)
  • G wants to minimize this (make D(G(z)) close to 1, so log(1-1) approaches negative infinity)

The Adversarial Dance

Think of it like a counterfeiter (generator) and detective (discriminator):

  • The detective wants to be really good at spotting fakes: maximize both terms
  • The counterfeiter wants to fool the detective: minimize the second term by making fakes look real

This creates a push-pull dynamic where both networks improve together through competition.

Key Takeaway: The GAN objective function formalizes the adversarial game as a minimax optimization where the discriminator maximizes classification accuracy while the generator minimizes it, driving both toward an equilibrium where generated samples become indistinguishable from real data.