The success of modern neural networks relies directly on two mathematical design choices: Activation Functions (which introduce non-linear expressiveness into neurons) and Loss Functions (which define what the network is penalizing during training).
| Activation Function | Mathematical Formula | Output Range | Pros & Modern Use Cases |
|---|---|---|---|
| Sigmoid (σ) | 1 / (1 + e⁻ᵞ) |
(0, 1) | Probabilistic output layer for binary classification. Not zero-centered. |
| Tanh (Hyperbolic Tangent) | (eᵞ - e⁻ᵞ) / (eᵞ + e⁻ᵞ) |
(-1, +1) | Zero-centered; common in recurrent networks (LSTMs). |
| ReLU (Rectified Linear) | max(0, z) |
[0, +∞) | Default standard: Blazing fast to compute; derivative=1 solves vanishing gradients. |
| Leaky ReLU | max(0.01z, z) |
(-∞, +∞) | Solves the "Dying ReLU" problem by providing a small gradient for z < 0. |
| GELU (Gaussian Error Linear) | z · Φ(z) |
[-0.17, +∞) | Modern LLM Standard: Smooth probabilistic gating used in GPT-4, BERT, and Claude. |
| Softmax | e^{z_i} / ∑ e^{z_j} |
(0, 1), sums to 1.0 | Output layer for multi-class classification (converts logits into probabilities). |
(1/N) ∑ (y - ŷ)². Heavily penalizes large outlier errors; yields conditional mean.(1/N) ∑ |y - ŷ|. Robust to outliers; yields conditional median.- [ y log(ŷ) + (1-y) log(1-ŷ) ].- ∑ y_c log(ŷ_c).Broaden your foundational and advanced Machine Learning knowledge across our curriculum:
How non-zero derivatives prevent dead neurons during backprop.
Select optimal activation functions for hidden vs output layers.
Modern activations used in modern vision and transformer models.
Why stacking linear layers without activation reduces to single layer.