Activation function
In artificial neural networks, the activation function of a node defines the output of that node given an input or set of inputs.
A standard integrated circuit can be seen as a digital network of activation functions that can be "ON" or "OFF", depending on input. This is similar to the behavior of the linear perceptron in neural networks. However, only nonlinear activation functions allow such networks to compute nontrivial problems using only a small number of nodes, and such activation functions are called nonlinearities.
Functions
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. The function looks like, where is the Heaviside step function.A line of positive slope may be used to reflect the increase in firing rate that occurs as input current increases. Such a function would be of the form, where is the slope. This activation function is linear and therefore cannot make decisions.
As biological neurons cannot lower their firing rate below zero, rectified linear activation functions are used:. They introduce a non-linearity at zero that can be used for decision making.
Neurons also cannot fire faster than a certain rate. Sigmoid activation functions use a second non-linearity for large inputs:. Because they are in the range between zero and one, sigmoid activations can be interpreted as probabilities. If a range from -1 to 1 is desired, the sigmoid can be scaled and shifted to yield the hyperbolic tangent activation function:.
Alternative structures
A special class of activation functions known as radial basis functions are used in RBF networks, which are extremely efficient as universal function approximators. These activation functions can take many forms, but they are usually found as one of three functions:- Gaussian:
- Multiquadratics:
- Inverse multiquadratics:
A computationally efficient Radial Basis Function has been proposed, called Square-law based RBF kernel which eliminates the exponential term as found in Gaussian RBF.
- SQ-RBF:
where and must satisfy certain conditions for convergence. These machines can also accept arbitrary-order polynomial activation functions where
Comparison of activation functions
There are numerous activation functions. Hinton et al.'s seminal 2012 paper on automatic speech recognition uses a logistic sigmoid activation function. The seminal 2012 AlexNet computer vision architecture uses the ReLU activation function, as did the seminal 2015 computer vision architecture ResNet. The seminal 2018 language processing model BERT uses a smooth version of the ReLU, the GELU.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.
- Monotonic – When the activation function is monotonic, the error surface associated with a single-layer model is guaranteed to be convex.
- Smooth functions with a monotonic derivative – These have been shown to generalize better in some cases.
- Approximates identity near the origin – When activation functions have this property, the neural network will learn efficiently when its weights are initialized with small random values. When the activation function does not approximate identity near the origin, special care must be used when initializing the weights. In the table below, activation functions where and and is continuous at 0 are indicated as having this property.
The following table compares the properties of several activation functions that are functions of one fold from the previous layer or layers:
Name | Plot | Equation | Derivative | Range | Order of continuity | Monotonic | Monotonic derivative | Approximates identity near the origin |
Identity | ||||||||
Binary step | ||||||||
Logistic | ||||||||
TanH | ||||||||
Rectified linear unit | ||||||||
Gaussian Error Linear Unit | ||||||||
SoftPlus | ||||||||
Exponential linear unit | ||||||||
Scaled exponential linear unit | with and | |||||||
Leaky rectified linear unit | ||||||||
Parameteric rectified linear unit | ||||||||
ArcTan | ||||||||
ElliotSig Softsign | ||||||||
S-shaped rectified linear activation unit | are parameters. | |||||||
Bent identity | ||||||||
Sigmoid Linear Unit | ||||||||
Sinusoid | ||||||||
Sinc | ||||||||
Gaussian | ||||||||
SQ-RBF |
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 |
Here, is the Kronecker delta.