Skip to content

Instantly share code, notes, and snippets.

@SkalskiP
Created October 7, 2018 18:52
Show Gist options
  • Select an option

  • Save SkalskiP/355beb0febd4f47e43650ef448749e11 to your computer and use it in GitHub Desktop.

Select an option

Save SkalskiP/355beb0febd4f47e43650ef448749e11 to your computer and use it in GitHub Desktop.
Activation functions
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