Skip to content

Instantly share code, notes, and snippets.

@acl21
Last active September 27, 2019 02:44
Show Gist options
  • Save acl21/64213c8f9f65bc362d595c7bec359548 to your computer and use it in GitHub Desktop.
Save acl21/64213c8f9f65bc362d595c7bec359548 to your computer and use it in GitHub Desktop.
RMSProp
def do_rmsprop():
w, b, eta = init_w, init_b, 0.1
v_w, v_b, beta, eps = 0, 0, 0.9, 1e-8
for i in range(max_epochs):
dw, db = 0, 0
for x,y in zip(X,Y):
dw += grad_w(w, b, x, y)
db += grad_b(w, b, x, y)
v_w = beta * v_w + (1 - beta) * dw**2
v_b = beta * v_b + (1 - beta) * db**2
w = w - (eta/np.sqrt(v_w + eps)) * dw
b = b - (eta/np.sqrt(v_b + eps)) * db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment