All problems
Epsilon-Greedy Action Probabilities
Problem
Return the action-probability vector induced by an epsilon-greedy policy.
Every action starts with epsilon / n, and the greedy action (smallest index on ties) additionally receives 1 - epsilon. An empty Q table returns [].
Hint
All actions share the exploration mass; only the greedy action gets the extra exploit mass.
Test cases
case 1
in: [[1,2,2],0.3]
expected: [0.09999999999999999,0.7999999999999999,0.09999999999999999]
case 2
in: [[5],0.4]
expected: [1]
case 3
in: [[0,0],0.5]
expected: [0.75,0.25]
case 4
in: [[-1,-2,-2],0]
expected: [1,0,0]
case 5
in: [[],0.5]
expected: []
Starter codePython
def epsilon_greedy_probs(Q, epsilon):
# Your code here
pass5 test cases · run your code against them in the editor