Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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'])
Copy link

The legend is wrong. Those admitted are more than those not admitted
it should be legend([" Admitted" , "Not Admitted"])

Copy link

sshaky2 commented Sep 29, 2016

Where can I find ex2data1.txt data set?

Copy link

yes please where can i find the data

Copy link

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