Skip to content

Instantly share code, notes, and snippets.

@victor-iyi
Last active November 12, 2017 20:38
Show Gist options
  • Select an option

  • Save victor-iyi/c5ad18b111ff308ef22abf7f17673e06 to your computer and use it in GitHub Desktop.

Select an option

Save victor-iyi/c5ad18b111ff308ef22abf7f17673e06 to your computer and use it in GitHub Desktop.
Neural network Basics: Part One (training)
for i in range(10000):
# Forward propagte our input to get a prediction
l1 = sigmoid(np.dot(X, W0))
l2 = sigmoid(np.dot(l1, W1))
# Estimate how much we missed
l2_error = (y - l2) ** 2
l2_delta = l2_error * sigmoid(l2, prime=True)
# Back propagate error in layer 2 into layer 1
l1_error = np.dot(l2_delta, W1.T)
l1_delta = l1_error * sigmoid(l1, prime=True)
# Update weights
W1 += np.dot(l1.T, l2_delta)
W0 += np.dot(X.T, l1_delta)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment