Skip to content

Instantly share code, notes, and snippets.

@acl21
Last active May 15, 2019 18:03
Show Gist options
  • Save acl21/ea90bccb1d69160e3df3ba3e417228cb to your computer and use it in GitHub Desktop.
Save acl21/ea90bccb1d69160e3df3ba3e417228cb to your computer and use it in GitHub Desktop.
Gradient Descent
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