Created
October 7, 2018 18:52
-
-
Save SkalskiP/355beb0febd4f47e43650ef448749e11 to your computer and use it in GitHub Desktop.
Activation functions
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 sigmoid(Z): | |
| return 1/(1+np.exp(-Z)) | |
| def relu(Z): | |
| return np.maximum(0,Z) | |
| def sigmoid_backward(dA, Z): | |
| sig = sigmoid(Z) | |
| return dA * sig * (1 - sig) | |
| def relu_backward(dA, Z): | |
| dZ = np.array(dA, copy = True) | |
| dZ[Z <= 0] = 0; | |
| return dZ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment