Skip to content
DeepForgeby svx
All problems

Dueling Centered Advantage

Problem

Center a dueling advantage stream by subtracting its mean.

Return advantage[a] - mean(advantage) for every action, which makes the advantage identifiable without changing the greedy action. An empty list returns [].

Hint

The value stream must carry the average action quality once advantages are centered.

Test cases

case 1
in: [[1,2,3]]
expected: [-1,0,1]
case 2
in: [[5,5]]
expected: [0,0]
case 3
in: [[]]
expected: []
case 4
in: [[-1,0,1]]
expected: [-1,0,1]
Starter codePython
def dueling_centered_advantage(advantage):
    # Your code here
    pass

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