Skip to content
DeepForgeby svx
All problems
MediumOptimizationop-303

EMA Bias Corrected Mean

Problem

An exponential moving average initialized at zero is biased toward zero; the corrected estimate is m / (1 - beta^t) where t is the number of updates.

Given the raw EMA m, the decay beta, and t >= 1, return the bias-corrected mean.

Hint

The correction divides out the geometric weight mass accumulated so far.

Test cases

case 1
in: [0.1,0.9,1]
expected: 1.0000000000000002
case 2
in: [0.5,0.9,10]
expected: 0.7676699663938148
case 3
in: [0.25,0.5,2]
expected: 0.3333333333333333
Starter codePython
def ema_bias_corrected_mean(m, beta, t):
    # Your code here
    pass

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