Study Vault Search notes, aliases and full text
Graph
ConceptDBISAI-written · not yet proofread

Sigmoid

The sigmoid (logistic) function σ(z) = 1 / (1 + e^(−z)) maps every real number strictly increasingly into the interval (0, 1).

Formula#

Derivative:

σ′(z)=σ(z)⋅(1−σ(z))=σ(z)⋅σ(−z)\sigma'(z) = \sigma(z) \cdot (1 - \sigma(z)) = \sigma(z) \cdot \sigma(-z)

Symmetry:

σ(−z)=1−σ(z)\sigma(-z) = 1 - \sigma(z)
ProofProof of σ′(t)=σ(t) σ(−t)\sigma'(t) = \sigma(t)\,\sigma(-t) (exam WS 21/22, Task 5.3)
  1. Chain rule: σ′(t)=−1(1+e−t)2⋅(−e−t)=e−t(1+e−t)2=11+e−t⋅e−t1+e−t\sigma'(t) = \frac{-1}{(1 + e^{-t})^2} \cdot (-e^{-t}) = \frac{e^{-t}}{(1 + e^{-t})^2} = \frac{1}{1 + e^{-t}} \cdot \frac{e^{-t}}{1 + e^{-t}}.
  2. The first factor is σ(t)\sigma(t).
  3. Second factor, multiplied by et/ete^{t}/e^{t}: e−t1+e−t=1et+1=σ(−t)\frac{e^{-t}}{1 + e^{-t}} = \frac{1}{e^{t} + 1} = \sigma(-t).

Hence σ′(t)=σ(t) σ(−t)\sigma'(t) = \sigma(t)\,\sigma(-t). The symmetry follows from σ(z)+σ(−z)=ezez+1+1ez+1=1\sigma(z) + \sigma(-z) = \frac{e^z}{e^z + 1} + \frac{1}{e^z + 1} = 1.

Properties#

  • σ(0)=0.5\sigma(0) = 0.5
  • lim⁡z→∞σ(z)=1\lim_{z \to \infty} \sigma(z) = 1, lim⁡z→−∞σ(z)=0\lim_{z \to -\infty} \sigma(z) = 0
  • Monotonically (strictly) increasing, since σ′(z)=σ(z)σ(−z)>0\sigma'(z) = \sigma(z)\sigma(-z) > 0. Hence σ(z)>1/2  ⟺  z>0\sigma(z) > 1/2 \iff z > 0.
  • Special case of Softmax for two classes: σ(x)=softmax([x,0])1\sigma(x) = \text{softmax}([x, 0])_1.
  • Used as the output function of Logistic Regression, where σ(w⋅x)\sigma(w \cdot x) is the predicted probability of class 1. The derivative formula gives the simple gradient (σ(w⋅x)−y) x(\sigma(w \cdot x) - y)\,x of the cross-entropy loss.

Example#

σ(0)=0.5\sigma(0) = 0.5, σ(1)≈0.731\sigma(1) \approx 0.731, σ(−1)≈0.269\sigma(-1) \approx 0.269, σ(2)≈0.881\sigma(2) \approx 0.881. Check of the symmetry: σ(1)+σ(−1)=1\sigma(1) + \sigma(-1) = 1. Check of the derivative: σ′(0)=σ(0) σ(0)=0.25\sigma'(0) = \sigma(0)\,\sigma(0) = 0.25, the maximal slope.

Sources#

  • Not covered by a WS 25/26 lecture. Source: the DBIS/IR exams.
  • Exam WS 21/22, Task 5.3 (not published) (derivative)
  • Exam WS 23/24, Task 5.2–5.3 (not published) (torch.sigmoid in training, softmax of (x,0)(x, 0))
  • Exam WS 23/24 (2nd date), Task 5.1 (not published) (definition in the logistic regression model)

Search

Type In
↑ ↓ move ↵ open ⇥ next section Ctrl↵ results page Prefix # to search text only