Created
November 6, 2020 17:28
-
-
Save enochkan/8352a7f77d46e2d43269c024870bc55b to your computer and use it in GitHub Desktop.
testing adam optim
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
w_0 = 0 | |
b_0 = 0 | |
adam = AdamOptim() | |
t = 1 | |
converged = False | |
while not converged: | |
dw = grad_function(w_0) | |
db = grad_function(b_0) | |
w_0_old = w_0 | |
w_0, b_0 = adam.update(t,w=w_0, b=b_0, dw=dw, db=db) | |
if check_convergence(w_0, w_0_old): | |
print('converged after '+str(t)+' iterations') | |
break | |
else: | |
print('iteration '+str(t)+': weight='+str(w_0)) | |
t+=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment