Spaces:
Sleeping
Sleeping
File size: 399 Bytes
b7f5a9c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import math
def sigmoid(x):
return 1.0 / (1.0 + math.exp(-x))
def sigmoid_prime(x): # x already sigmoided
return x * (1 - x)
def relu(x):
return max(0,x)
def relu_prime(x):
return 1 if x>0 else 0
def tanh(x):
return math.tanh(x)
def tanh_prime(x):
return 1 - x**2
def softmax(x):
return math.exp(x) / (math.exp(x) + 1)
def softmax_prime(x):
return x * (1 - x) |