Created
September 3, 2016 11:25
-
-
Save jakab922/79610ebf467d6490f36b3f8495b63cba to your computer and use it in GitHub Desktop.
Gradient decent for linear regression
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
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