Skip to content
DeepForgeby svx
All problems

CRR Advantage Weights

Problem

Compute binary CRR advantage weights: 1.0 when the advantage is strictly above the threshold, otherwise 0.0. An empty batch returns [].

Hint

Binary CRR simply filters out actions that were worse than average.

Test cases

case 1
in: [[1,-1,0],0]
expected: [1,0,0]
case 2
in: [[-0.5,0.5],0]
expected: [0,1]
case 3
in: [[],1]
expected: []
Starter codePython
def crr_advantage_weights(advantages, threshold):
    # Your code here
    pass

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