tensorflow-for-deep-learnin.../Numpy/neuron.py
Marina von Steinkirch db89b720d8 clean up
2016-08-14 15:58:23 -07:00

7 lines
No EOL
305 B
Python

class Neuron(object):
# ...
def forward(inputs):
""" assume inputs and weights are 1-D numpy arrays and bias is a number """
cell_body_sum = np.sum(inputs * self.weights) + self.bias
firing_rate = 1.0 / (1.0 + math.exp(-cell_body_sum)) # sigmoid activation function
return firing_rate