All problems
Running Variance Update
Problem
Update a running variance estimate with exponential moving averaging: new_var = (1 - momentum) * running_var + momentum * batch_var.
The signature is running_var_update(running_var, batch_var, momentum).
Hint
Blend the old statistic with the batch statistic using the momentum coefficient.
Test cases
case 1
in: [0,1,0.1]
expected: 0.1
case 2
in: [1,0,0.1]
expected: 0.9
case 3
in: [0.5,0.5,0.9]
expected: 0.5
case 4
in: [0,4,0.25]
expected: 1
Starter codePython
def running_var_update(running_var, batch_var, momentum):
# Your code here
pass4 test cases · run your code against them in the editor