All problems
Prioritized Replay Probability
Problem
Convert replay priorities into a sampling distribution.
Return p_i^alpha / sum_j p_j^alpha for each priority. Priorities are positive and the list is non-empty.
Hint
Alpha of 0 gives uniform sampling; alpha of 1 samples proportional to priority.
Test cases
case 1
in: [[1,2,3],1]
expected: [0.16666666666666666,0.3333333333333333,0.5]
case 2
in: [[1,1,1,1],0.5]
expected: [0.25,0.25,0.25,0.25]
case 3
in: [[4,9],0.5]
expected: [0.4,0.6]
case 4
in: [[1,2,3],0]
expected: [0.3333333333333333,0.3333333333333333,0.3333333333333333]
Starter codePython
def prioritized_probs(priorities, alpha):
# Your code here
pass4 test cases · run your code against them in the editor