Skip to content

Instantly share code, notes, and snippets.

@marcelcaraciolo
Created November 6, 2011 14:24
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save marcelcaraciolo/1342942 to your computer and use it in GitHub Desktop.
Save marcelcaraciolo/1342942 to your computer and use it in GitHub Desktop.
log_regression
from numpy import loadtxt, where
from pylab import scatter, show, legend, xlabel, ylabel
#load the dataset
data = loadtxt('ex2data1.txt', delimiter=',')
X = data[:, 0:2]
y = data[:, 2]
pos = where(y == 1)
neg = where(y == 0)
scatter(X[pos, 0], X[pos, 1], marker='o', c='b')
scatter(X[neg, 0], X[neg, 1], marker='x', c='r')
xlabel('Exam 1 score')
ylabel('Exam 2 score')
legend(['Not Admitted', 'Admitted'])
show()
@sshaky2
Copy link

sshaky2 commented Sep 29, 2016

Where can I find ex2data1.txt data set?

@arjunchatterjee196
Copy link

yes please where can i find the data

@vinipachecov
Copy link

@cristianounix
Copy link

Hi @vinipachecov this link dosen't exists anymore... :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment