All problems
Adam Moment Estimate Update
Problem
Adam maintains m_new = beta1 * m + (1 - beta1) * g and v_new = beta2 * v + (1 - beta2) * g^2.
Given the current m, v, the gradient g, beta1, and beta2, return [m_new, v_new] for a scalar parameter.
Hint
The first moment averages gradients, the second averages squared gradients.
Test cases
case 1
in: [0,0,1,0.9,0.999]
expected: [0.09999999999999998,0.0010000000000000009]
case 2
in: [1,2,-0.5,0.5,0.5]
expected: [0.25,1.125]
case 3
in: [0.2,0.1,3,0.99,0.999]
expected: [0.22800000000000004,0.10890000000000001]
Starter codePython
def adam_moment_estimate_update(m, v, g, beta1, beta2):
# Your code here
pass3 test cases · run your code against them in the editor