Skip to content
DeepForgeby svx
All problems

Action Normalization

Problem

Normalize a continuous action from [low, high] into [-1, 1]: 2 * (action - low) / (high - low) - 1.

Hint

The normalized action is what tanh-squashed policies output.

Test cases

case 1
in: [0,-1,1]
expected: 0
case 2
in: [1,-1,1]
expected: 1
case 3
in: [-1,-1,1]
expected: -1
case 4
in: [2.5,0,5]
expected: 0
Starter codePython
def action_normalization(action, low, high):
    # Your code here
    pass

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