Skip to content
DeepForgeby svx
All problems
EasyOptimizationop-315

Adam Bias Corrected Moments

Problem

Adam corrects the moving averages with m_hat = m / (1 - beta1^t) and v_hat = v / (1 - beta2^t).

Given m, v, beta1, beta2, and the step t >= 1, return [m_hat, v_hat].

Hint

Divide each moment by one minus the decay raised to the step count.

Test cases

case 1
in: [0.1,0.01,0.9,0.999,1]
expected: [1.0000000000000002,9.999999999999991]
case 2
in: [0.5,0.5,0.9,0.9,10]
expected: [0.7676699663938148,0.7676699663938148]
case 3
in: [0,0,0.5,0.5,3]
expected: [0,0]
Starter codePython
def adam_bias_corrected_moments(m, v, beta1, beta2, t):
    # Your code here
    pass

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