view tvii/sigmoid.py @ 17:bf8bd42f8cd7

[sigmoid] use numpy + add docstring
author Jeff Hammel <k0scist@gmail.com>
date Sun, 03 Sep 2017 16:38:43 -0700
parents b95fe82ac9ce
children cd43ce453358
line wrap: on
line source

"""
sigmoid function: 1/(1 + e^-z)
"""

import numpy as np


def sigmoid(z):
    """https://en.wikipedia.org/wiki/Sigmoid_function"""
    return 1./(1. + np.exp(-z))