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