Skip to content

Commit

Permalink
Update activation_functions.py
Browse files Browse the repository at this point in the history
  • Loading branch information
bfortuner committed Nov 29, 2017
1 parent c0b1fda commit ced172c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions code/activation_functions.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
import math
import numpy as np

### Note ###

# z is weighted input


### Functions ###

def relu(z):
return max(0, z)

def relu_prime(z):
return 1 if z > 0 else 0

def sigmoid(z):
return 1.0 / (1 + np.exp(-z))



### Derivatives ###

def sigmoid_prime(z):
return sigmoid(z) * (1-sigmoid(z))

def relu_prime(z):
return 1 if z > 0 else 0

0 comments on commit ced172c

Please sign in to comment.