ReLU (Rectified Linear Unit) is one of the most widely used activation functions in neural networks, particularly in deep learning models.
Formula: ReLU(x) = max(0, x)
This can also be written as:
ReLU(x) = x if x > 0
ReLU(x) = 0 if x ≤ 0
How it works: ReLU simply outputs the input value if it's positive, and outputs zero if the input is negative or zero. This creates a "rectified" linear function that eliminates negative values while preserving positive ones unchanged.
Key characteristics:
Simplicity: The function is computationally efficient, involving only a simple comparison and selection
Non-linearity: Despite its simple form, ReLU introduces non-linearity into the network, which is essential for learning complex patterns
Sparsity: Many neurons will output zero, creating sparse representations that can be computationally beneficial
No saturation: Unlike sigmoid or tanh functions, ReLU doesn't saturate for positive values, helping to mitigate the vanishing gradient problem
Advantages:
Fast computation (just a max operation)
Helps reduce vanishing gradient problems
Promotes sparsity in neural networks
Works well in practice for many applications
Disadvantages:
Can suffer from the "dying ReLU" problem where neurons get stuck outputting zero
Not differentiable at x = 0 (though this is typically handled by setting the derivative to 0 or 1 at that point)
Lokendra SinghPosted Jun 6, 2025, 9:15 AM
ReLU (Rectified Linear Unit) is one of the most widely used activation functions in neural networks, particularly in deep learning models.
Formula: ReLU(x) = max(0, x)
This can also be written as:
How it works: ReLU simply outputs the input value if it's positive, and outputs zero if the input is negative or zero. This creates a "rectified" linear function that eliminates negative values while preserving positive ones unchanged.
Key characteristics:
Advantages:
Disadvantages: