Numpy-Neuron / neural_network /activation.py
Jensen-holm's picture
we should try to do this with regression on a simple dataset from the internet somewhere because I think it is hard to see how well it is doing with completley random data
4175aca
raw
history blame
270 Bytes
import numpy as np
relu = lambda x: np.maximum(x, 0)
relu_prime = lambda x: np.where(x > 0, 1, 0)
tanh = lambda x: np.tanh(x)
tanh_prime = lambda x: 1 - tanh(x) ** 2
sigmoid = lambda x: 1.0 / (1.0 + np.exp(-x))
sigmoid_prime = lambda x: sigmoid(x) / 1.0 - sigmoid(x)