Last active
March 27, 2018 14:52
-
-
Save mempirate/c08c0ec116182010084772bc7ee2f67c to your computer and use it in GitHub Desktop.
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
# Train by iterating 10,000 times | |
for iteration in range(10000): | |
# Define input layer | |
input_layer = training_inputs | |
# Normalize the product of the input layer with the synaptic | |
# weights by using the sigmoid function to get outputs | |
outputs = sigmoid(np.dot(input_layer, synaptic_weights)) | |
# Calculate the error | |
error = training_outputs - outputs | |
# Multiply how much we missed by the slope of the sigmoid at the values in outputs | |
adjustments = error * sigmoid_derivative(outputs) | |
# Update the weights using our adjustments | |
synaptic_weights += np.dot(input_layer.T, adjustments) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment