Create a Neural
Network for the
previous data set.
from itertools import chain
p = Perceptron(2)
def lin1(x):
return x + 4
for point in class1:
p.adjust(1, p(point), point)
for point in class2:
p.adjust(0, p(point), point)
evaluation = Counter()
for point in chain(class1, class2):
if p(point) == 1:
evaluation["correct"] += 1
else:
evaluation["wrong"] += 1
testpoints = [(3.9, 6.9), (-2.9, -5.9)]
for point in testpoints:
print(p(point))
print(evaluation.most_common())