All problems
Exploration Bonus Schedule
Problem
Cosine-anneal an exploration bonus from beta_start down to beta_min.
Return beta_min + 0.5 * (beta_start - beta_min) * (1 + cos(pi * t / total_steps)). If total_steps is not positive or t is at least total_steps, return beta_min.
Hint
Cosine annealing starts slow, decays quickly in the middle, then eases out.
Test cases
case 1
in: [0,100,1,0]
expected: 1
case 2
in: [50,100,1,0]
expected: 0.5
case 3
in: [100,100,1,0]
expected: 0
case 4
in: [150,100,2,0.5]
expected: 0.5
Starter codePython
import math
def exploration_bonus_schedule(t, total_steps, beta_start, beta_min):
# Your code here
pass4 test cases · run your code against them in the editor