Skip to content
DeepForgeby svx
All problems

AWAC Advantage Weights

Problem

Compute AWAC policy weights as exp(advantage / lam), capped at max_weight to bound the update. Return one weight per advantage.

Hint

The exponential tilt makes good actions much more likely to be imitated.

Test cases

case 1
in: [[0,1],1,10]
expected: [1,2.718281828459045]
case 2
in: [[0,5],1,10]
expected: [1,10]
case 3
in: [[-1],0.5,100]
expected: [0.1353352832366127]
Starter codePython
import math
def awac_advantage_weights(advantages, lam, max_weight):
    # Your code here
    pass

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