Activation function
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 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. 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.
Mathematical details
The most common activation functions can be divided into three categories: ridge functions, radial functions and fold functions.An activation function is saturating if. It is nonsaturating if. Non-saturating activation functions, such as ReLU, may be better than saturating activation functions, because they are less likely to suffer from the vanishing gradient problem.
Ridge activation functions
Ridge functions are multivariate functions acting on a linear combination of the input variables. Often used examples include:In biologically inspired neural networks, the activation function is usually an abstraction representing the rate of action potential firing in the cell. In its simplest form, this function is binary—that is, either the neuron is firing or not.
Neurons also cannot fire faster than a certain rate. This biological limitation motivates the use of sigmoid activation functions, whose output range is confined to a finite interval.
The function looks like, where is the Heaviside step function.
If a line has a positive slope, on the other hand, it may reflect the increase in firing rate that occurs as input current increases. Such a function would be of the form.
[Image:ReLU_and_GELU.svg|thumb|Rectified linear unit and Gaussian error linear unit activation functions]
Radial activation functions
A special class of activation functions known as radial basis functions are used in RBF networks. These activation functions can take many forms, but they are usually found as one of the following functions:- Gaussian:
- Multiquadratics:
- Inverse multiquadratics:
- Polyharmonic splines
Other examples
Periodic functions can serve as activation functions. Usually the sinusoid is used, as any periodic function is decomposable into sinusoids by the Fourier transform.Quadratic activation maps.
Folding activation functions
Folding activation functions are extensively used in the pooling layers in convolutional neural networks, and in output layers of multiclass classification networks. These activations perform aggregation over the inputs, such as taking the mean, minimum or maximum. In multiclass classification the softmax activation is often used.Table of activation functions
The following table compares the properties of several activation functions that are functions of one fold from the previous layer or layers:| Name | Plot | Function, | Derivative of, | Range | Order of continuity |
| Identity | |||||
| Binary step | |||||
| Logistic, sigmoid, or softstep | |||||
| Hyperbolic tangent | |||||
| Soboleva modified hyperbolic tangent | |||||
| Softsign | |||||
| Rectified linear unit | |||||
| Gaussian Error Linear Unit | where is the gaussian error function. | where is the probability density function of standard gaussian distribution. | |||
| Softplus | |||||
| Exponential linear unit (ELU) | where | ||||
| Sigmoid linear unit | |||||
| Exponential Linear Sigmoid SquasHing | |||||
| Gaussian | |||||
| Sinusoid |
The following table lists activation functions that are not functions of a single fold from the previous layer or layers:
| Name | Equation, | Derivatives, | Range | Order of continuity |
| Softmax | for = 1, …, | |||
| Maxout |