Skip to content
DeepForgeby svx
All problems
EasyOptimizationop-038

Bias Correction First Moment

Problem

Bias-correct the first moment estimate used by Adam:

m_hat = m / (1 - beta1^t)

where t is the 1-indexed step number. Return the corrected value.

Hint

At t = 1 the divisor is 1 - beta1, which amplifies the raw moment.

Test cases

case 1
in: [0.5,0.9,1]
expected: 5.000000000000001
case 2
in: [0.5,0.9,10]
expected: 0.7676699663938148
case 3
in: [0,0.9,5]
expected: 0
case 4
in: [2,0.5,3]
expected: 2.2857142857142856
Starter codePython
def bias_correct_first(m, beta1, t):
    # Your code here
    pass

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