First page Back Continue Last page Overview Graphics

Using the Perceptron Class

p = Perceptron(2, np.array([0.5, 0.5]))

for x in [np.array([0, 0]), np.array([0, 1]),

np.array([1, 0]), np.array([1, 1])]:

y = p(np.array(x))

print(x, y)

[0 0] 0

[0 1] 0

[1 0] 0

[1 1] 1