Skip to content
DeepForgeby svx
All problems

Value Function Loss

Problem

Compute the mean squared error between predicted state values and their targets. An empty batch returns 0.0.

Hint

The critic regresses the value estimate onto the bootstrapped return target.

Test cases

case 1
in: [[1,2],[1,4]]
expected: 2
case 2
in: [[],[]]
expected: 0
case 3
in: [[3],[3]]
expected: 0
case 4
in: [[0,1,2],[2,1,0]]
expected: 2.6666666666666665
Starter codePython
def value_loss(values, targets):
    # Your code here
    pass

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