From 428390082d12b11edfd2d75a4af5f9c5bf85675b Mon Sep 17 00:00:00 2001 From: George Lacey Date: Wed, 8 Feb 2017 23:17:26 +0000 Subject: [PATCH] Initial commit --- Input.py | 11 +++++++++++ Main.py | 0 Perceptron.py | 18 ++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 Input.py create mode 100644 Main.py create mode 100644 Perceptron.py diff --git a/Input.py b/Input.py new file mode 100644 index 0000000..ae7c255 --- /dev/null +++ b/Input.py @@ -0,0 +1,11 @@ +class Input(object): + + def __init__(self, p_value, p_weight): + self.value = p_value + self.weight = p_weight + + def print(self): + print("value: %f\nweight: %f") % (self.value, self.weight) + + def setweight(self, p_weight): + self.weight = p_weight \ No newline at end of file diff --git a/Main.py b/Main.py new file mode 100644 index 0000000..e69de29 diff --git a/Perceptron.py b/Perceptron.py new file mode 100644 index 0000000..820a11f --- /dev/null +++ b/Perceptron.py @@ -0,0 +1,18 @@ +from Input import Input + + +class Perceptron(object): + + def __init__(self): + self.inputs = {} + + def print(self): + for key, value in self.inputs: + print("%s - )") % key + value.print() + + def addinput(self, p_name, p_value, p_weight): + self.inputs[p_name] = Input(p_value, p_weight) + + def setweight(self, p_input, p_weight): + self.inputs[p_input].weight = p_weight