Initial commit
This commit is contained in:
parent
a4e188d5f3
commit
428390082d
11
Input.py
Normal file
11
Input.py
Normal file
|
@ -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
|
18
Perceptron.py
Normal file
18
Perceptron.py
Normal file
|
@ -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
|
Loading…
Reference in New Issue
Block a user