Skip to content

Instantly share code, notes, and snippets.

@himanshuxd
Last active May 27, 2024 07:05
Show Gist options
  • 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