Skip to content

Instantly share code, notes, and snippets.

@marcelcaraciolo
Created October 28, 2011 03:21
Show Gist options
  • Save marcelcaraciolo/1321551 to your computer and use it in GitHub Desktop.
Save marcelcaraciolo/1321551 to your computer and use it in GitHub Desktop.
linear regression
from numpy import loadtxt, zeros, ones, array, linspace, logspace
from pylab import scatter, show, title, xlabel, ylabel, plot, contour
#Load the dataset
data = loadtxt('ex1data1.txt', delimiter=',')
#Plot the data
scatter(data[:, 0], data[:, 1], marker='o', c='b')
title('Profits distribution')
xlabel('Population of City in 10,000s')
ylabel('Profit in $10,000s')
show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment