Last active
November 12, 2017 20:38
-
-
Save victor-iyi/c5ad18b111ff308ef22abf7f17673e06 to your computer and use it in GitHub Desktop.
Neural network Basics: Part One (training)
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
| 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