Skip to content
DeepForgeby svx
All problems

UCB Exploration Bonus

Problem

Compute the UCB exploration bonus c * sqrt(ln(t) / count).

count is how many times the action has been pulled and t is the total number of pulls so far. A non-positive count returns 0.0 to keep the result finite.

Hint

The bonus shrinks as the action is pulled more often.

Test cases

case 1
in: [5,10,1]
expected: 0.6786140424415112
case 2
in: [1,100,2]
expected: 4.291932052578694
case 3
in: [0,10,1]
expected: 0
case 4
in: [4,4,1]
expected: 0.5887050112577373
Starter codePython
import math
def ucb_exploration_bonus(count, t, c):
    # Your code here
    pass

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