🌏 中文版
Video status: recordings require sign-in or course authorization. This guide uses public slides and assignments; numerical examples are site-authored, not a lecture transcript.
A classifier asks which class an image belongs to. A GAN generator asks how random inputs can produce new samples resembling the dataset. There is no unique correct image for every random input; another learned model supplies feedback. We first calculate the two objectives, then use a small factor graph to explain the lecture's probabilistic graphical model section.
Prerequisites are convolution, binary classification, and logarithms. All examples are original. G maps noise z into G(z), and D estimates whether a sample comes from real data. G can be deterministic for fixed z while random z induces a distribution of outputs.
Two models have different objectives
A discriminator commonly minimizes L_D=−ln D(x)−ln(1−D(G(z))). Its first term rewards assigning high probability to real samples; its second rewards assigning low probability to fake samples. The original minimax generator minimizes ln(1−D(G(z))). The common non-saturating alternative minimizes −ln D(G(z)), improving the learning signal when the discriminator is strong. Label which objective you use.
Suppose D(real)=0.8 and D(fake)=0.2. The discriminator loss is 0.4463. The generator's non-saturating loss is 1.6094, while its minimax term is −0.2231. These are numerically and conceptually different objectives.
If the generator changes the fake sample so that a fixed discriminator gives it 0.6, the non-saturating loss falls to 0.5108. The discriminator loss rises to 1.1394. There is no contradiction: the fake is now harder for D to reject and more successful for G.
Alternation requires the right gradient paths
During a discriminator update, detach generated samples so the classification step does not also update G. During a generator update, freeze D's parameters but preserve its input derivatives so gradients can pass through D into G. Wrapping D's entire forward pass in no_grad would cut that path as well.
Practical training usually alternates a limited number of minibatch steps rather than optimizing each player completely. Each objective changes as the other player changes, so a falling isolated loss does not establish a better learned distribution. G may repeatedly produce a few samples that fool D while missing other modes: mode collapse.
A conditional GAN can give a class or another condition to both models. If D cannot see the condition, it may judge realism without directly enforcing condition agreement. Generating plausible images and generating images consistent with a requested class require distinct checks.
Factor graphs convert local scores into probabilities
The lecture also represents variable dependencies with probabilistic graphical models. Consider binary variables a and b. Let φ₁(a)=2 for a=1 and 1 otherwise, and φ₂(a,b)=3 if a=b and 1 otherwise. Multiply these local factors to obtain unnormalized joint weights.
States (0,0), (0,1), (1,0), and (1,1) have weights 3,1,2,6. Their sum is Z=12, so probabilities are those weights divided by 12. Thus p(a=1)=2/3 and p(b=1|a=1)=6/(2+6)=3/4.
A factor value of three is a score, not a probability of three. Global normalization requires summing every state's weight. Conditional normalization instead sums only states satisfying the condition. Local factorization can make structure explicit while global normalization or marginalization remains expensive.
A GAN does not need a directly evaluable generator likelihood. Sharing a lecture with PGM does not mean its training calculates this kind of partition function.
Variations with answers
Keep D(real)=0.8 but set D(fake)=0.1. The discriminator loss becomes 0.3285 and the non-saturating generator loss becomes 2.3026. Classification improved for D while the generator objective worsened.
Set φ₁(1)=1 instead of two. The four weights become 3,1,1,3, giving Z=8 and p(a=1)=1/2. The conditional p(b=1|a=1) remains 3/4 because the shared factor cancels when a is fixed. The next lecture uses a directed noise chain to turn graphical structure into a computable diffusion process.
Previous | Next | Series overview
Course Video Sources
The official recording index is on SCS Panopto. The anonymous folder view is unloaded and requests sign-in; this is an access limitation, not evidence that recordings do not exist. Original audio and subtitles require the appropriate course access.