NumPy allowed · plain Python earns 10 bonus points
θ ← θ − 0.14 · ∂L/∂θ
Accelerate stochastic gradient descent and dampen oscillations along ravines using classical momentum.
Implement sgd_momentum_step(param, grad, velocity, lr, momentum): for each index k, update the velocity as v_k = momentum * velocity[k] + lr * grad[k], and then update the parameter as param_k = param[k] - v_k. Return a dictionary {'param': [...], 'velocity': [...]} with each float rounded to 6 decimal places.
sgd_momentum_step(param: list[float], grad: list[float], velocity: list[float], lr: float, momentum: float) -> dict