Skip to content

Instantly share code, notes, and snippets.

@supereng
Forked from marcelcaraciolo/linregr.py
Created March 11, 2017 22:41
Show Gist options
  • Save supereng/64cfda8ca42ee5b37e996148c0bded16 to your computer and use it in GitHub Desktop.
Save supereng/64cfda8ca42ee5b37e996148c0bded16 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