RMSprop Update
Implement rmsprop_update(weights, grad_sq, gradient, learning_rate, beta, epsilon). Return (weights_new, grad_sq_new).
Examples
Weights after update, cold start beta=0 (accessor [0])
- Input
- rmsprop_update([1], [0], [2], 0.1, 0, 0)
- [0] of result
- [0.9]
Weights: warm grad_sq normalizes step (accessor [0])
- Input
- rmsprop_update([0], [9], [3], 0.1, 0, 0)
- [0] of result
- [-0.1]
grad_sq_new accumulates (accessor [1])
- Input
- rmsprop_update([0], [0], [4], 0.1, 0.9, 0)
- [1] of result
- [1.6]
Hints
Hint 1
Take the square root at the end, not inside the sum.
Hint 2
Do not forget to 1 minus beta factor. That step is easy to skip.
Requirements
weights: Current weight vectorgrad_sq: Running squared-gradient average (same shape): Current gradient
learning_rate: Global step size (alpha)beta: Decay rate for squared gradient accumulatorepsilon: Numerical stability constantReturn Tuple (weights_new, grad_sq_new).
Constraints
Allowed library: NumPy only
Time limit: 200 ms, Memory: 64 MB
Where this shows up
8 employers weight this skill
4 big tech firms, 2 quant funds, 1 frontier lab, 1 autonomy company. Top match scores 91.
import numpy as np
def rmsprop_update(weights: np.ndarray, grad_sq: np.ndarray, gradient: np.ndarray,
learning_rate: float, beta: float, epsilon: float):
"""
Perform one RMSprop update step.
Args:
weights: Current weight vector
grad_sq: Running squared-gradient average (same shape)
gradient: Current gradient
learning_rate: Global step size (alpha)
beta: Decay rate for squared gradient accumulator
epsilon: Numerical stability constant
Returns:
Tuple (weights_new, grad_sq_new).
"""
# YOUR CODE HERE
pass