-
-
Save shamdasani/ec74fa2f08a0b886be16612631e2a372 to your computer and use it in GitHub Desktop.
This file contains 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 backward(self, X, y, o): | |
# backward propgate through the network | |
self.o_error = y - o # error in output | |
self.o_delta = self.o_error*self.sigmoidPrime(o) # applying derivative of sigmoid to error | |
self.z2_error = self.o_delta.dot(self.W2.T) # z2 error: how much our hidden layer weights contributed to output error | |
self.z2_delta = self.z2_error*self.sigmoidPrime(self.z2) # applying derivative of sigmoid to z2 error | |
self.W1 += X.T.dot(self.z2_delta) # adjusting first set (input --> hidden) weights | |
self.W2 += self.z2.T.dot(self.o_delta) # adjusting second set (hidden --> output) weights |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment