Skip to content
DeepForgeby svx
All problems

GAIL Discriminator Loss Lite

Problem

Compute the binary cross-entropy loss of a GAIL discriminator.

Expert samples have target 1 and policy samples target 0: L = -mean(log(D(expert)) + log(1 - D(policy))). Probabilities are strictly between 0 and 1 and the batch is non-empty.

Hint

The discriminator tries to distinguish expert transitions from policy transitions.

Test cases

case 1
in: [[0.9,0.8],[0.1,0.2]]
expected: 0.328504066972036
case 2
in: [[0.5],[0.5]]
expected: 1.3862943611198906
case 3
in: [[1,0.99],[0.01,0.01]]
expected: 0.015075503780252176
Starter codePython
import math
def gail_discriminator_loss(d_expert, d_policy):
    # Your code here
    pass

3 test cases · run your code against them in the editor