From 829ff199a3e08e505744dcf5b2ad162e5c74ee0e Mon Sep 17 00:00:00 2001 From: George Lacey Date: Fri, 10 Feb 2017 15:31:47 +0000 Subject: [PATCH] Fix input method --- Perceptron.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Perceptron.py b/Perceptron.py index 382867f..3d5a31d 100644 --- a/Perceptron.py +++ b/Perceptron.py @@ -12,8 +12,8 @@ class Perceptron(object): self.inputs[key].print() def input(self, p_input1, p_input2): - self.inputs[0] = p_input1 - self.inputs[1] = p_input2 + self.inputs['1'].value = float(p_input1) + self.inputs['2'].value = float(p_input2) def add_input(self, p_name, p_value, p_weight): self.inputs[p_name] = Input(p_value, p_weight) @@ -23,8 +23,8 @@ class Perceptron(object): def _sum_inputs(self): total = 0 - for key, value in self.inputs.items(): - total += value.output() + for key in self.inputs: + total += self.inputs[key].output() return total def activation(self):