Skip to content
DeepForgeby svx
All problems

Behavior Policy Estimate

Problem

Estimate the behavior policy from action counts.

Return counts[a] / total for each action. If all counts are zero return zeros, and an empty list returns [].

Hint

Offline methods often need the behavior propensity of each logged action.

Test cases

case 1
in: [[3,1]]
expected: [0.75,0.25]
case 2
in: [[0,0]]
expected: [0,0]
case 3
in: [[2,2,2,2]]
expected: [0.25,0.25,0.25,0.25]
case 4
in: [[]]
expected: []
Starter codePython
def behavior_policy_estimate(action_counts):
    # Your code here
    pass

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