Skip to content
DeepForgeby svx
All problems

TD3+BC Lambda Value

Problem

Compute the TD3+BC mixing coefficient lambda = alpha / mean(|Q|).

Divide alpha by the mean absolute Q value over the batch. An empty batch or an all-zero Q batch returns 0.0.

Hint

Scaling by the Q magnitude keeps the behavioral cloning term unitless.

Test cases

case 1
in: [[1,2,3],2.5]
expected: 1.25
case 2
in: [[-1,1],1]
expected: 1
case 3
in: [[0,0],2]
expected: 0
case 4
in: [[],1]
expected: 0
case 5
in: [[2,4],3]
expected: 1
Starter codePython
def td3bc_lambda(q_values, alpha):
    # Your code here
    pass

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