---
title: activation function
slug: activation-function
qid: Q4677469
snapshot: activation-function-534766-cd8eab6b5952a267
content_hash: cd8eab6b5952a2674216423fc965c86f5bb1baf26280276c323de2a523eb0d20
license: CC BY-SA 4.0
source: https://en.wikipedia.org/w/index.php?oldid=1375551500
tags: [22896689, 22913207, 22921969, 23118434, 23603337, 24745122, 50753147, 76930758]
---

# activation function

> [!note] Provenance
> Snapshot `activation-function-534766-cd8eab6b5952a267` · content root `cd8eab6b5952a267…`
> Derived from <https://en.wikipedia.org/w/index.php?oldid=1375551500> · Licensed CC BY-SA 4.0

In artificial neural networks, the activation function of a node is a function that calculates the output of the node based on its individual inputs and their weights. Nontrivial problems can be solved using only a few nodes if the activation function is nonlinear. Modern activation functions include the logistic (sigmoid) function used in the 2012 speech recognition model developed by Hinton et al; the ReLU used in the 2012 AlexNet computer vision model and in the 2015 ResNet model; and the smooth version of the ReLU, the GELU, which was used in the 2018 BERT model.

In artificial neural networks, the activation function of a node is a function that calculates the output of the node based on its individual inputs and their weights. Nontrivial problems can be solved using only a few nodes if the activation function is nonlinear. Modern activation functions include the logistic (sigmoid) function used in the 2012 speech recognition model developed by Hinton et al; the ReLU used in the 2012 AlexNet computer vision model and in the 2015 ResNet model; and the smooth version of the ReLU, the GELU, which was used in the 2018 BERT model. ==Comparison of activation functions== Aside from their empirical performance, activation functions also have different mathematical properties: Nonlinear: When the activation function is non-linear, then a two-layer neural network can be proven to be a universal function approximator. This is known as the Universal Approximation Theorem. The identity activation function does not satisfy this property. When multiple layers use the identity activation function, the entire network is equivalent to a single-layer model. Range: When the range of the activation function is finite, gradient-based training methods tend to be more stable, because pattern presentations significantly affect only limited weights. When the range is infinite, training is generally more efficient because pattern presentations significantly affect most of the weights. In the latter case, smaller learning rates are typically necessary. Continuously differentiable: This property is desirable for enabling gradient-based optimization methods (ReLU is not continuously differentiable and has some issues with gradient-based optimization, but it is still possible). The binary step activation function is not differentiable at 0, and it differentiates to 0 for all other values, so gradient-based methods can make no progress with it. These properties do not decisively influence performance, nor are they the only mathematical properties that may be useful. For instance, the strictly positive range of the softplus makes it suitable for predicting variances in variational autoencoders. {}={} &x\Phi(x) \end{align} where \mathrm{erf} is the gaussian error function. | \Phi(x) + \frac 12 x\phi(x) where \phi(x) = \frac{1}{\sqrt{2\pi}} e^{-\frac 12 x^2} is the probability density function of standard gaussian distribution. | (-0.17\ldots, \infty) | C^\infty |- | Softplus | | \ln\left(1 + e^x\right) | \frac{1}{1 + e^{-x}} | (0,\infty) | C^\infty |- | Exponential linear unit (ELU) | | \begin{cases} \alpha\left(e^x - 1\right) & \text{if } x \le 0\\ x & \text{if } x > 0 \end{cases} with parameter \alpha | \begin{cases} \alpha e^x & \text{if } x 0 \end{cases} | (-\alpha,\infty) | \begin{cases} C^1 & \text{if } \alpha = 1 \\ C^0 & \text{otherwise} \end{cases} |- | Scaled exponential linear unit (SELU) | | \lambda \begin{cases} \alpha(e^x - 1) & \text{if } x with parameters \lambda = 1.0507 and \alpha = 1.67326 | \lambda \begin{cases} \alpha e^x & \text{if } x | (-\lambda\alpha,\infty) | C^0 |- | Leaky rectified linear unit (Leaky ReLU) | | \begin{cases} 0.01x & \text{if } x \le 0\\ x & \text{if } x > 0 \end{cases} | \begin{cases} 0.01 & \text{if } x 0 \end{cases} | (-\infty,\infty) | C^0 |- | Parametric rectified linear unit (PReLU) | | \begin{cases} \alpha x & \text{if } x with parameter \alpha | \begin{cases} \alpha & \text{if } x | (-\infty,\infty) | C^0 |- | Rectified Parametric Sigmoid Units (flexible, 5 parameters) | | \alpha (2x {1}_{ \{ x \geqslant \lambda \} } - g_{\lambda, \sigma, \mu, \beta}(x)) + (1-\alpha) g_{\lambda, \sigma, \mu, \beta}(x) where g_{\lambda, \sigma, \mu, \beta}(x) = \frac{ (x - \lambda) {1}_{ \{ x \geqslant \lambda \} } }{ 1 + e^{- \sgn(x-\mu) \left( \frac{\vert x-\mu \vert}{\sigma} \right)^\beta } } | - | (-\infty,\infty) | C^0 |- | Sigmoid linear unit (SiLU, Sigmoid shrinkage, SiL, or Swish- 1 ) | | \frac{x}{1 + e^{-x}} | \frac{1 + e^{-x} + xe^{-x}}{\left(1 + e^{-x}\right)^2} | [-0.278\ldots, \infty) | C^\infty |- |Exponential Linear Sigmoid SquasHing (ELiSH) | | \begin{cases} \frac{e^x - 1}{1 + e^{-x}} & \text{if } x | \begin{cases} \frac{2e^{2x}+e^{3x}-e^x}{e^{2x}+2e^x+1} & \text{if }x | [-0.881\ldots, \infty) | C^1 |- | Gaussian | | e^{-x^2} | -2xe^{-x^2} | (0,1] | C^\infty |- |Sinusoid | | \sin x | \cos x | [-1, 1] | C^\infty |} The following table lists activation functions that are not functions of a single fold from the previous layer or layers: Here, \delta_{ij} is the Kronecker delta. For instance, j could be iterating through the number of kernels of the previous neural network layer while i iterates through the number of kernels of the current layer. ==See also== Logistic function Rectifier (neural networks) Stability (learning theory) Softmax function ==References==
