Last active
May 15, 2019 18:03
-
-
Save acl21/ea90bccb1d69160e3df3ba3e417228cb to your computer and use it in GitHub Desktop.
Gradient Descent
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_gradient_descent(): | |
w, b, eta, max_epochs = init_w, init_b, 1.0, 100 | |
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) | |
############################# | |
w = w - eta * dw | |
b = b - eta * db | |
print(error(w,b)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment