Skip to content
DeepForgeby svx
All problems
MediumOptimizationop-307

RMSProp Single Scalar Step

Problem

RMSProp tracks v_new = rho * v + (1 - rho) * g^2 and updates x_new = x - lr * g / sqrt(v_new + eps).

Given x, g, v, rho, lr, and eps, return [x_new, v_new].

Hint

Update the running average of squares before dividing.

Test cases

case 1
in: [1,0.5,0,0.9,0.01,1e-8]
expected: [0.9683772297228697,0.024999999999999994]
case 2
in: [0,-1,0.5,0.5,0.1,1e-8]
expected: [0.1154700530681248,0.75]
case 3
in: [3,2,4,0.99,1,0]
expected: [2,4]
Starter codePython
def rmsprop_single_scalar_step(x, g, v, rho, lr, eps):
    # Your code here
    pass

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