Skip to content
DeepForgeby svx
All problems

Observation Scaling

Problem

Map observations from their raw range into [0, 1]: (x - low[i]) / (high[i] - low[i]) elementwise.

Hint

Bounded observations stabilize neural network training.

Test cases

case 1
in: [[5,0],[0,0],[10,10]]
expected: [0.5,0]
case 2
in: [[10,10],[0,0],[10,10]]
expected: [1,1]
case 3
in: [[2],[1],[5]]
expected: [0.25]
Starter codePython
def observation_scaling(observation, low, high):
    # Your code here
    pass

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