Adam Optimizer Update
Adam: Adaptive Moment Estimation
Adam combines momentum (first moment) and RMSprop (second moment) with bias correction:
The bias correction (, ) accounts for the fact that and are initialized at zero and are biased toward zero in early steps.
Typical defaults: , , , .
Your task:
Implement adam_update(weights, m, v, gradient, learning_rate, beta1, beta2, epsilon, t). Return (weights_new, m_new, v_new).
Example Tests
First step, cold start: weights decrease (accessor [0])
Input: {"m":[0],"t":1,"v":[0],"beta1":0.9,"beta2":0.99,"epsilon":1e-8,"weights":[0],"gradient":[1],"learning_rate":0.001}
Expected: [-0.001]
Zero gradient: weights unchanged (accessor [0])
Input: {"m":[0,0],"t":1,"v":[0,0],"beta1":0.9,"beta2":0.99,"epsilon":1e-8,"weights":[1,-1],"gradient":[0,0],"learning_rate":0.01}
Expected: [1,-1]
m_new correct (accessor [1])
Input: {"m":[0],"t":1,"v":[0],"beta1":0.9,"beta2":0.99,"epsilon":1e-8,"weights":[0],"gradient":[1],"learning_rate":0.001}
Expected: [0.1]