All problems
GAN Discriminator Loss
Problem
Compute the binary cross-entropy discriminator loss: -mean(log(D(real))) - mean(log(1 - D(fake))), averaged over all samples together. D outputs probabilities in (0, 1).
The signature is gan_discriminator_loss(real_probs, fake_probs).
Hint
The discriminator wants D(real) near 1 and D(fake) near 0.
Test cases
case 1
in: [[0.9],[0.1]]
expected: 0.1053605157
case 2
in: [[0.5,0.5],[0.5,0.5]]
expected: 0.6931471806
case 3
in: [[0.7],[0.3]]
expected: 0.3566749439
case 4
in: [[1],[0]]
expected: 0
Starter codePython
import math
def gan_discriminator_loss(real_probs, fake_probs):
# Your code here
pass4 test cases · run your code against them in the editor