Neural networks

sigmoid function

/ SIG-moyd FUNK-shun /

The sigmoid is a smooth S-shaped curve that takes any number — huge, tiny, negative, positive — and gently squashes it into the range between 0 and 1. Picture a slide that's nearly flat at the top, steep in the middle, and nearly flat again at the bottom. Feed in a big positive number and it comes out near 1; a big negative number comes out near 0; zero comes out at exactly 0.5. Because the output looks like a probability, sigmoid is a natural way to express "how confident am I that the answer is yes?"

Historically the sigmoid was the workhorse activation of neural networks, and it remains the standard final step for yes/no (binary) classification, where you want a single output you can read as a probability. It's the very same curve that powers logistic regression. The smoothness is genuinely useful: because the curve has a gentle slope everywhere, the learning algorithm can always tell which way to nudge the weights.

But that smoothness hides a trap. At the flat ends — for large positive or large negative inputs — the slope is almost zero. When the slope is near zero, the learning signal that flows backward through the network gets multiplied by almost nothing and nearly vanishes. Stack several sigmoid layers and these tiny slopes multiply together, so the earliest layers barely learn at all. This is the vanishing-gradient problem, and it's the main reason ReLU has replaced sigmoid in the hidden layers of modern deep networks. Sigmoid lives on mostly at the output.

A model judging whether an email is spam outputs a single sigmoid value of 0.92. You read that as "92% confident this is spam." Had the raw score been a large negative number, the sigmoid would have returned something like 0.03 — "almost certainly not spam." The S-curve turns an unbounded score into a tidy probability between 0 and 1.

Sigmoid maps any score to a 0–1 "probability" — ideal for a final yes/no decision.

A sigmoid output near 0 or near 1 isn't necessarily a well-calibrated probability — it only looks like one. And its flat tails are exactly why people stopped using it in deep hidden layers: it strangles the gradient.

Also called
logistic functionlogistic sigmoidS 形函数对数几率函数邏輯函數