π Activation Functions
Descriptionβ
An activation function applies a non-linear transformation to a layer's pre-activation value:
Without activations, a neural network is only a stack of affine transformationsβeffectively one linear model, no matter how many layers it has.
Why activation functions are neededβ
Two affine layers collapse into one:
- Introduce non-linearity: ReLU, sigmoid, and tanh prevent this collapse, letting a network learn curved decision boundaries and other non-linear patterns.
- Enable deep representations: Non-linear layers can compose progressively richer features; universal-approximation results show that networks with suitable activations can approximate broad classes of continuous functions.
- Support gradient flow: Backpropagation applies the chain rule through each activation. Useful derivatives help learning; saturated sigmoid or tanh units can have derivatives near zero.
- Output Range Normalization: Sigmoid maps one output to for binary probabilities, softmax produces a distribution over classes, and tanh bounds values to .
- Create sparse activations with ReLU: ReLU turns negative inputs into zero; this can produce sparse features and can be cheaper when an implementation exploits the zeros. Leaky ReLU retains a small negative slope to reduce dead units.
Summary metaphor: Imagine driving a car π. Without an activation function, your steering wheel is bolted straight aheadβyou can only go in a straight line. Activation functions are the steering mechanism that lets you turn left, right, and navigate the winding roads of real-world data!