All problems
Prioritized TD Error
Problem
Convert TD errors into non-negative replay priorities.
Each priority is (|delta| + epsilon) ** alpha, so zero errors still receive a small non-zero priority. Return a list of the same length; an empty input returns [].
Hint
High-advantage and high-error transitions get replayed more often.
Test cases
case 1
in: [[1,-2],1]
expected: [1.000001,2.000001]
case 2
in: [[0],0.5]
expected: [0.001]
case 3
in: [[],0.5]
expected: []
case 4
in: [[4,9],0.5]
expected: [2.0000002499999843,3.000000166666662]
Starter codePython
def prioritized_td_error(td_errors, alpha, epsilon=1e-6):
# Your code here
pass4 test cases · run your code against them in the editor