First page Back Continue Last page Overview Graphics

Visualize Decision Boundary

from matplotlib import pyplot as plt

X, Y = zip(*class1)

plt.scatter(X, Y, c="r")

X, Y = zip(*class2)

plt.scatter(X, Y, c="b")

x = np.arange(-7, 10)

y = 5*x + 10

m = -p.weights[0] / p.weights[1]

plt.plot(x, m*x)

plt.show()