Created
September 27, 2019 01:34
-
-
Save acl21/f3b229d1747857235899f9e23616c7a2 to your computer and use it in GitHub Desktop.
AdaGrad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def do_adagrad(): | |
w, b, eta = init_w, init_b, 0.1 | |
v_w, v_b, eps = 0, 0, 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 = v_w + dw**2 | |
v_b = v_b + 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