The perceptron's sign function gives a hard yes/no. What if a neuron needs to answer "mostly yes," or needs a slope to learn from at all?
Drag the input across all four at once. Step jumps instantly between 0 and 1 — no in-between. Sigmoid and tanh curve smoothly through the middle. ReLU — short for Rectified Linear Unit — does something different again: it's flat at exactly 0 for every negative input, then rises like a plain diagonal line.
An activation function turns a neuron's raw weighted sum into its output. Four of the most common:
- — the neuron's raw weighted sum, before activation.
- — the perceptron's hard yes/no rule: 0 below zero, 1 at or above it.
- — the sigmoid, a smooth curve ranging over .
- — a smooth curve ranging over .
- — zero for negative inputs, and equal to itself for positive ones.
- Step has no usable slope
Step is what the perceptron used — but it's flat everywhere except one point, so its slope is useless for learning by gradient.
- Sigmoid and tanh are smooth substitutes
Both curve smoothly through the middle, giving a real, usable slope everywhere.
- ReLU trades smoothness for simplicity
It throws out smoothness for something else: dead simple to compute, and its slope never shrinks to nothing on the positive side.
Watch what happens right around . Step is discontinuous there. Sigmoid and tanh are at their steepest — right where they're most useful for learning. ReLU has a kink: flat on the left, a clean 45° line on the right.
Tanh isn't a fourth independent shape — it's sigmoid, rescaled: .
- Evaluate sigmoid at 2x
At : .
- Rescale it into tanh's range
— exactly . Sigmoid ranges over ; tanh stretches and shifts that same curve to range over .
Drag the input until sigmoid’s output reaches 0.9 (within 0.02).
Every neuron in every network from here on is a weighted sum fed through one of these. The choice matters enormously once networks get deep — the next chapters are about exactly what goes wrong (or right) when you stack many of these on top of each other.