annotate tvii/sigmoid.py @ 16:b95fe82ac9ce

more notes to self
author Jeff Hammel <k0scist@gmail.com>
date Sun, 03 Sep 2017 13:17:33 -0700
parents
children bf8bd42f8cd7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16
b95fe82ac9ce more notes to self
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
1 """
b95fe82ac9ce more notes to self
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
2 sigmoid function: 1/(1 + e^-z)
b95fe82ac9ce more notes to self
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
3 """
b95fe82ac9ce more notes to self
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
4
b95fe82ac9ce more notes to self
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
5 import math
b95fe82ac9ce more notes to self
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
6
b95fe82ac9ce more notes to self
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
7 def sigmoid(z):
b95fe82ac9ce more notes to self
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
8 return 1./(1. + math.exp(-z))