Sigmoid Function
Last Updated: July 29, 2026 | By Mihail Sebastian | AI Dictionary
An S-shaped function that maps any real number to a value between 0 and 1, used to turn a model's raw score into a probability in binary classification.
What is the Sigmoid Function?
The sigmoid function maps any real number to a value between 0 and 1 along an S-shaped curve, which makes it the standard way to turn a model’s raw score into a probability.
It serves as the output layer for binary classification networks and is the core of logistic regression. As an activation function inside hidden layers, it has largely given way to ReLU.
How the Sigmoid Function Works
The formula is:
\[ \sigma(x) = \frac{1}{1 + e^{-x}} \]Large positive inputs land near 1, large negative inputs near 0, and \( \sigma(0) = 0.5 \), the point of maximum uncertainty. The output never quite reaches 0 or 1, so the model always expresses some doubt.
Its derivative has the tidy form \( \sigma(x)(1 - \sigma(x)) \), cheap to compute during backpropagation. But that same derivative peaks at 0.25 and collapses toward zero where the curve flattens, so stacking sigmoid layers starves deep networks of gradient. This vanishing gradient problem is why sigmoid retreated from hidden layers to the output layer, where it still excels.
Sigmoid vs Softmax
Sigmoid produces one independent probability; softmax produces a set of probabilities that compete and sum to 1. Use sigmoid when the question is yes-or-no, or when several labels can be true at once (a photo can contain both a beach and a dog, so each label gets its own sigmoid).
Use softmax when exactly one class must win. For two classes the pair coincide: softmax over two scores equals a sigmoid of their difference.
| Sigmoid | Softmax | |
|---|---|---|
| Input | A single score | A vector of scores |
| Output | One probability between 0 and 1 | Probabilities that sum to 1 |
| Task | Binary or multi-label classification | Single-choice multi-class classification |
| Independence | Each output stands alone | Raising one class’s probability lowers the others |
Example of the Sigmoid Function
A spam classifier ends in a single neuron that outputs a raw score. For one email the score is 2, and the sigmoid converts it:
\[ \sigma(2) = \frac{1}{1 + e^{-2}} \approx 0.88 \]The filter reads this as an 88% probability of spam. With the decision threshold at 0.5 the email goes to the junk folder; a stricter operator could raise the threshold to 0.9 and let it through, which is exactly the flexibility a probability gives that a bare yes/no never could.
Related AI terms: Softmax · Activation Function · Logistic Regression · Vanishing Gradient · Classification
Did you like the Sigmoid Function gist?
Learn about 250+ need-to-know artificial intelligence terms in the AI Dictionary.
Mihail Sebastian — Writes about AI governance, regulation, and the technology behind them. Placeholder bio — replace with a real credential line. About