Created
August 17, 2015 03:51
-
-
Save miloharper/64437344fd1428806332 to your computer and use it in GitHub Desktop.
Snippet of code which shows how the neural network trains.
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, example): | |
self.reset_errors() | |
error = example.output - self.think(example.inputs) | |
self.layers[-1].neurons[0].error = error | |
for l in range(len(self.layers) - 1, 0, -1): | |
for neuron in self.layers[l].neurons: | |
self.layers[l - 1] = neuron.train(self.layers[l - 1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment