Skip to content
DeepForgeby svx
All problems
EasyOptimizationop-311

Exponential Decay Half Life Steps

Problem

For exponential decay lr_t = lr0 * exp(-decay * t), the learning rate halves after ln(2) / decay steps.

Given the decay rate, return the number of steps to halve the learning rate.

Hint

Solve exp(-decay * t) = 1/2 for t.

Test cases

case 1
in: [0.1]
expected: 6.931471805599452
case 2
in: [1]
expected: 0.6931471805599453
case 3
in: [0.01]
expected: 69.31471805599453
Starter codePython
def exponential_decay_half_life_steps(decay):
    # Your code here
    pass

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