Created
October 28, 2011 03:36
-
-
Save marcelcaraciolo/1321566 to your computer and use it in GitHub Desktop.
linear regression
This file contains 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
X = data[:, 0] | |
y = data[:, 1] | |
#number of training samples | |
m = y.size | |
#Add a column of ones to X (interception data) | |
it = ones(shape=(m, 2)) | |
it[:, 1] = X | |
#Initialize theta parameters | |
theta = zeros(shape=(2, 1)) | |
#Some gradient descent settings | |
iterations = 1500 | |
alpha = 0.01 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment