Sigmoid and Tanh

Sigmoid and tanh are older, bounded activation functions that still matter conceptually.

The sigmoid function maps inputs to values between 0 and 1:

sigmoid(x) = 1 / (1 + exp(-x))

The tanh function maps inputs to values between -1 and 1.

sigmoidtanhxoutputbounded outputs
Sigmoid and tanh are bounded nonlinearities; their flat tails can make gradients small.

Both functions are nonlinear. Both squash large positive or negative inputs into bounded ranges.

Useful intuition

Sigmoid is useful when you want a number that behaves like a soft yes/no quantity.

Tanh is centered around zero, so negative inputs produce negative outputs and positive inputs produce positive outputs.

In modern deep networks, ReLU-like activations often replaced sigmoid and tanh in hidden layers because they are less prone to saturation for positive values. But sigmoid and tanh remain important for understanding gates, probabilities, and historical neural networks.

DL-C04-T03-001Exercise: Sigmoid range

Enter 1 if sigmoid outputs are always between 0 and 1, or 0 if they can be any real number.

Compute it first, then check your number.

HintThink bounded

Sigmoid squashes real inputs into a limited range.

SolutionWork it out

Sigmoid maps any real input to a value between 0 and 1.

DL-C04-T03-002Exercise: Tanh range

Enter 1 if tanh can output negative values, or 0 if tanh is never negative.

Compute it first, then check your number.

HintCentered range

Tanh is centered around zero.

SolutionWork it out

Tanh outputs values between -1 and 1, so it can be negative.