Skip to content

Instantly share code, notes, and snippets.

@jakab922
Created September 3, 2016 11:25
Show Gist options
  • Save jakab922/79610ebf467d6490f36b3f8495b63cba to your computer and use it in GitHub Desktop.
Save jakab922/79610ebf467d6490f36b3f8495b63cba to your computer and use it in GitHub Desktop.
Gradient decent for linear regression
import numpy as np
def gradient_descent(x, y, alpha, rounds):
z = np.ones(x.shapes[1])
for _ in xrange(rounds):
z = z - alpha * np.dot(np.dot(X, z) - y, X)
return z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment