Mercurial > hg > tvii
view tvii/activation.py @ 82:c05ce6b7f941
test distance calculations
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 17 Dec 2017 13:45:44 -0800 |
parents | 857a606783e1 |
children |
line wrap: on
line source
""" activation functions """ # tanh: # g(z) = tanh(z) = (exp(z) - exp(-z))/(exp(z) + exp(-z)) # g'(z) = 1 - (tanh(z))**2 # ReLU def ReLU(z): return max((0, z)) def ReLUprime(z): return 1. if z > 0 else 0.