Created
August 17, 2015 03:46
-
-
Save miloharper/960a610947956832416f to your computer and use it in GitHub Desktop.
Snippet of code showing the training function for a Neuron.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def train(self, previous_layer): | |
for synapse in self.synapses: | |
# Propagate the error back down the synapse to the neuron in the layer below | |
previous_layer.neurons[synapse.input_neuron_index].error += self.error * sigmoid_derivative(self.output) * synapse.weight | |
# Adjust the synapse weight | |
synapse.weight += synapse.signal * self.error * sigmoid_derivative(self.output) | |
return previous_layer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment