Intermediate Topic 31 of 51 AI & Machine Learning
Activation Functions
Nonlinearities such as ReLU and sigmoid.
How it works
Activation functions introduce nonlinearity into neural networks, without which stacked layers would collapse into a single linear map. Sigmoid squashes values to 0 to 1 and tanh to minus 1 to 1 but saturate and cause vanishing gradients; ReLU outputs max of zero and x, is cheap and the default for hidden layers, with variants such as leaky ReLU, GELU and SiLU; softmax turns scores into class probabilities in the output layer; linear outputs suit regression.
Step-by-step walkthrough
- Without nonlinearity many layers collapse to one linear map.
- ReLU outputs zero for negatives and x for positives, cheap and common.
- Sigmoid squashes to between 0 and 1.
- Tanh centres outputs around 0.
- Softmax turns scores into probabilities that sum to 1.
Where it is used
Choosing activations affects training speed and stability in convolutional networks, transformers, classifiers and generative models.
Common pitfall
Sigmoid and tanh in deep networks cause vanishing gradients, and ReLU can produce dead neurons that always output zero. Softmax needs numerically stable implementations. Output activation must match the loss, such as sigmoid with binary cross-entropy. Initialization schemes such as He and Xavier are designed for specific activations. Start with ReLU or GELU in hidden layers.
Where it fits in the course
Activation Functions is topic 31 of 51 in AI & Machine Learning, rated Intermediate. It follows Perceptron. The next topic is Backpropagation.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the AI & Machine Learning quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the AI & Machine Learning quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is Activation Functions?
Where do people use Activation Functions?
What is the most common mistake with Activation Functions?
What should I learn before this topic?
How can I practice it?
Is Activation Functions hard to learn?
How long does it take to learn Activation Functions?
Which topics are related to Activation Functions?
What should I study after Activation Functions?
Related topics
- Perceptron (AI & Machine Learning)
- Backpropagation (AI & Machine Learning)
- Neural Networks (AI & Machine Learning)
- Convolutional Neural Networks (AI & Machine Learning)
- Functions and Relations (Theory & Discrete Math)
- Functions and Graphs (Math for Computing)
- Functions (Programming Fundamentals)