Overview#Sigmoid function is a mathematical function having a characteristic "S"-shaped curve or sigmoid curve.
Often, Sigmoid function refers to the special case of the logistic function shown in the first figure and defined by the formula
Other examples of similar shapes include the Gompertz curve (used in modeling systems that saturate at large values of x) and the ogee curve (used in the spillway of some dams). Sigmoid functions have domain of all real numbers, with return value monotonically increasing most often from 0 to 1 or alternatively from −1 to 1, depending on convention.
A wide variety of Sigmoid functions have been used as the Activation Function of Artificial Neurons, including the logistic and hyperbolic tangent functions. Sigmoid curves are also common in statistics as cumulative distribution functions (which go from 0 to 1), such as the integrals of the logistic distribution, the normal distribution, and Student's t probability density functions.
import numpy as np def sigmoid(): return 1 / (1 + np.exp(-x)) # derivative of sigmoid # sigmoid(y) * (1.0 - sigmoid(y)) # the way we use this y is already sigmoided def dsigmoid(): return y * (1.0 - y)