Create a gist now

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'])

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

sshaky2 commented Sep 29, 2016

Where can I find ex2data1.txt data set?

yes please where can i find the data

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