First page Back Continue Last page Overview Graphics

Plotting the Decision Boundary

from matplotlib import pyplot as plt

cls = [[], []]

for point in points:

cls[above_line(point, lin1)].append(tuple(point))

colours = ("r", "b")

for i in range(2):

X, Y = zip(*cls[i])

plt.scatter(X, Y, c=colours[i])

X = np.arange(-3, 120)

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

print(m)

plt.plot(X, m*X, label="ANN line")

plt.plot(X, lin1(X), label="lin1")

plt.legend()

plt.show()

0.947300480367