Why Do We Need Activation Functions?
Without an activation function, a neural network is just a long chain of multiplications and additions. No matter how many layers you add, it can only learn straight-line relationships. Activation functions add a bend (non-linearity), so the network can learn curves and complex patterns, such as the shape of a face.
Common Activation Functions
| Function | Output range | Use it for |
|---|---|---|
| ReLU | 0 to infinity | Hidden layers (the default choice) |
| Leaky ReLU | Small negative to infinity | Hidden layers when ReLU neurons die |
| Sigmoid | 0 to 1 | Output of binary classification |
| Tanh | -1 to 1 | Hidden layers in some RNNs |
| Softmax | 0 to 1, sum is 1 | Output for multi-class classification |
| Linear (none) | Any number | Output for regression |
ReLU
ReLU stands for Rectified Linear Unit. The rule is very simple: if the number is negative, output 0, otherwise output the number itself. It is fast and works very well, so it is the default in most hidden layers.
Sigmoid
Sigmoid squashes any number into the range between 0 and 1. It is perfect for answering yes or no questions, because the output can be read as a probability.
Softmax
Softmax turns a list of scores into probabilities that add up to 1. It is used in the last layer when there are more than two classes.
The first class gets the highest probability (about 66 percent).
Using Activations in Keras
Quick Rules
- Hidden layers: start with ReLU
- Binary classification output: sigmoid with 1 neuron
- Multi-class classification output: softmax with one neuron per class
- Regression output: no activation (linear)
Conclusion
Activation functions give neural networks their power. Remember ReLU for hidden layers and match your output activation to the task.

