Skip to content

Instantly share code, notes, and snippets.

@himanshuxd
Created January 19, 2019 03:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save himanshuxd/892881c7733385aff61a17342ee59342 to your computer and use it in GitHub Desktop.
Save himanshuxd/892881c7733385aff61a17342ee59342 to your computer and use it in GitHub Desktop.
Forward Propagating Single Neuron
class Neuron(object):
# ...
def forward(self, 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment