From d91911691afddba8a3aba0e2766259135446a8cf Mon Sep 17 00:00:00 2001 From: George Lacey <490796@hull.ac.uk> Date: Fri, 10 Feb 2017 12:12:44 +0000 Subject: [PATCH] Implement guess method --- Perceptron.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Perceptron.py b/Perceptron.py index 327d17e..f499cc0 100644 --- a/Perceptron.py +++ b/Perceptron.py @@ -27,6 +27,11 @@ class Perceptron(object): print("Total = %f" % input) if input > 0: - return True + return 1 else: - return False + return -1 + + def guess(self, p_desired): + prediction = float(self.activation()) + return p_desired - prediction +