y=11+exy = \dfrac{1}{1+e^{-x}}

The Logistic (Sigmoid) Function y=11+exy = \dfrac{1}{1+e^{-x}}

The logistic function y=11+exy = \dfrac{1}{1+e^{-x}}, also called the standard sigmoid, is the archetypal S-shaped curve1. It confines the output between 00 and 11 whatever the real input, which makes it well suited to representing a probability or a degree of being on or off.

Domain and range

  • The domain is all real numbers
  • The range is the open interval (0,1)(0, 1)
  • It increases monotonically
  • The lines y=0y = 0 and y=1y = 1 are horizontal asymptotes

The denominator 1+ex1 + e^{-x} is always positive, and the values at the two ends are never reached.

Symmetry

Since f(x)=1f(x)f(-x) = 1 - f(x), the graph has point symmetry about (0,12)\left( 0, \dfrac{1}{2} \right).

xxf(x)f(x)f(x)f(-x)Sum
110.7311\approx 0.73110.2689\approx 0.268911
220.8808\approx 0.88080.1192\approx 0.119211
440.9820\approx 0.98200.0180\approx 0.018011

Monotonicity

The function has the striking property that its derivative can be written in terms of itself.

f(x)=f(x)(1f(x))=ex(1+ex)2f'(x) = f(x)\bigl(1 - f(x)\bigr) = \frac{e^{-x}}{(1+e^{-x})^2}

It is always positive, so the function increases over the whole line. The slope is greatest at the center x=0x = 0, where it equals 14\dfrac{1}{4}. Where the value is near 00 or 11 the slope is almost 00, and that is what leads to the vanishing gradient in deep networks.

Inflection point

The second derivative is f=f(1f)(12f)f'' = f(1-f)(1-2f), whose sign changes at f=12f = \dfrac{1}{2}, that is at x=0x = 0. The point (0,12)\left( 0, \dfrac{1}{2} \right) is the only inflection point, and the curve turns there from concave up to concave down.

Relation to the hyperbolic tangent

f(x)=12(1+tanhx2)f(x) = \frac{1}{2}\left(1 + \tanh\frac{x}{2}\right)

It coincides with tanh\tanh widened by a factor of 22 horizontally, halved vertically and lifted by 12\dfrac{1}{2}.

Item11+ex\dfrac{1}{1+e^{-x}}tanhx\tanh x
Range(0,1)(0, 1)(1,1)(-1, 1)
Center of symmetry(0,12)\left( 0, \dfrac{1}{2} \right)(0,0)(0, 0)
Slope at the origin14\dfrac{1}{4}11

They are the same shape, differing only in range and scale.

Applications and history

In the nineteenth century the Belgian mathematician Verhulst introduced it as the solution of the logistic equation, which models the growth of a population in an environment of limited resources.

  • The model of a probability in logistic regression
  • An activation function in neural networks
  • Population growth and the progress of a chemical reaction
  1. Logistic function, Wikipedia