In [1]:
import numpy as np
In [3]:
X = np.array([[1,1],[2,1],[1,3],[2,3]])
y = np.array([[0,0,1,1]])
In [47]:
import matplotlib as mpl
import matplotlib.pyplot as plt
%matplotlib inline
fig = plt.figure()
ax = fig.add_subplot(111)
plt.scatter(X[0:2,0],X[0:2,1],color='Blue',marker='^',s=50)
plt.scatter(X[2:,0],X[2:,1],color='Green',marker='o',s=50)
x1 = np.arange(0, 2.5, 0.1)
x2 = 2*x1
plt.plot(x1,x2, color='red',linestyle='-.')
x2 = 0*x1 + 2
plt.plot(x1,x2, color='red',linestyle='-')
x2 = 0*x1 + 1.5
plt.plot(x1,x2, color='red',linestyle='--')
ax.text(1.3, 4, "$x_2 - 2x_1 = 0$")
ax.text(2.2, 2.1, "$x_2 - 2 = 0$")
ax.text(2.2, 1.2, "$x_2 - 1.5 = 0$")
Out[47]: