Skip to content
DeepForgeby svx
All problems

Behavioral Cloning Loss

Problem

Compute the behavioral cloning loss as the negative mean log-probability of the demonstrated actions. An empty batch returns 0.0.

Hint

Minimizing this loss is equivalent to maximizing the likelihood of the demonstrations.

Test cases

case 1
in: [[-0.5,-1]]
expected: 0.75
case 2
in: [[0]]
expected: 0
case 3
in: [[-2,-0.5,-1]]
expected: 1.1666666666666667
case 4
in: [[]]
expected: 0
Starter codePython
def behavioral_cloning_loss(log_probs):
    # Your code here
    pass

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