Fix input method
This commit is contained in:
parent
79694344a5
commit
6a3253df56
|
@ -12,8 +12,8 @@ class Perceptron(object):
|
||||||
self.inputs[key].print()
|
self.inputs[key].print()
|
||||||
|
|
||||||
def input(self, p_input1, p_input2):
|
def input(self, p_input1, p_input2):
|
||||||
self.inputs[0] = p_input1
|
self.inputs['1'].value = float(p_input1)
|
||||||
self.inputs[1] = p_input2
|
self.inputs['2'].value = float(p_input2)
|
||||||
|
|
||||||
def add_input(self, p_name, p_value, p_weight):
|
def add_input(self, p_name, p_value, p_weight):
|
||||||
self.inputs[p_name] = Input(p_value, p_weight)
|
self.inputs[p_name] = Input(p_value, p_weight)
|
||||||
|
@ -23,8 +23,8 @@ class Perceptron(object):
|
||||||
|
|
||||||
def _sum_inputs(self):
|
def _sum_inputs(self):
|
||||||
total = 0
|
total = 0
|
||||||
for key, value in self.inputs.items():
|
for key in self.inputs:
|
||||||
total += value.output()
|
total += self.inputs[key].output()
|
||||||
return total
|
return total
|
||||||
|
|
||||||
def activation(self):
|
def activation(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user