Skip to content
DeepForgeby svx
All problems

Prioritized IS Weight

Problem

Compute normalized importance-sampling weights for prioritized experience replay.

raw_i = (1 / (n * probs[i])) ** beta, then divide every raw weight by the largest one so the maximum weight becomes 1.0. Probabilities are positive.

Hint

High-priority samples are over-represented, so their updates are down-weighted.

Test cases

case 1
in: [[0.5,0.5],0.4]
expected: [1,1]
case 2
in: [[0.25,0.75],1]
expected: [1,0.3333333333333333]
case 3
in: [[0.1,0.2,0.7],0.5]
expected: [1,0.7071067811865476,0.37796447300922725]
case 4
in: [[1],0.6]
expected: [1]
Starter codePython
def prioritized_is_weight(probs, beta):
    # Your code here
    pass

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