Activation function

Last updated
Logistic activation function Logistic-curve.svg
Logistic activation function

The activation function of a node in an artificial neural network 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. [1] Modern activation functions include the smooth version of the ReLU, the GELU, which was used in the 2018 BERT model, [2] the logistic (sigmoid) function used in the 2012 speech recognition model developed by Hinton et al, [3] the ReLU used in the 2012 AlexNet computer vision model [4] [5] and in the 2015 ResNet model.

Contents

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. [6] 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.[ citation needed ]
Continuously differentiable
This property is desirable (ReLU is not continuously differentiable and has some issues with gradient-based optimization, but it is still possible) 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. [7]

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 it is . 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. [8]

Ridge activation functions

Ridge functions are multivariate functions acting on a linear combination of the input variables. Often used examples include:[ clarification needed ]

In biologically inspired neural networks, the activation function is usually an abstraction representing the rate of action potential firing in the cell. [9] 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, motivating sigmoid activation functions whose range is 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 .

Rectified linear unit and Gaussian error linear unit activation functions ReLU and GELU.svg
Rectified linear unit and Gaussian error linear unit activation functions

Radial activation functions

A special class of activation functions known as radial basis functions (RBFs) are used in RBF networks. These activation functions can take many forms, but they are usually found as one of the following functions:

where is the vector representing the function center and and are parameters affecting the spread of the radius.

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. [10]

Quadratic activation maps . [11] [12]

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 x from the previous layer or layers:

NamePlotFunction, Derivative of , Range Order of continuity
Identity Activation identity.svg
Binary step Activation binary step.svg
Logistic, sigmoid, or soft step Activation logistic.svg
Hyperbolic tangent (tanh) Activation tanh.svg
Soboleva modified hyperbolic tangent (smht) SMHTAF size.png
Rectified linear unit (ReLU) [13] Activation rectified linear.svg
Gaussian Error Linear Unit (GELU) [2] Activation gelu.png
Softplus [14] Activation softplus.svg
Exponential linear unit (ELU) [15] Activation elu.svg
with parameter
Scaled exponential linear unit (SELU) [16] Activation selu.png
with parameters and
Leaky rectified linear unit (Leaky ReLU) [17] Activation prelu.svg
Parametric rectified linear unit (PReLU) [18] Activation prelu.svg
with parameter
Rectified Parametric Sigmoid Units (flexible, 5 parameters)
Rectified Parametric Sigmoid Units RePSU.svg
Rectified Parametric Sigmoid Units

where [19]

Sigmoid linear unit (SiLU, [2] Sigmoid shrinkage, [20] SiL, [21] or Swish-1 [22] ) Swish.svg
Exponential Linear Sigmoid SquasHing (ELiSH) [23]
An image of the ELiSH activation function plotted over the range [-3, 3] with a minumum value of ~0.881 at x ~= -0.172. Elish activation function.png
An image of the ELiSH activation function plotted over the range [-3, 3] with a minumum value of ~0.881 at x ~= -0.172.
Gaussian Activation gaussian.svg
Sinusoid

The following table lists activation functions that are not functions of a single fold x from the previous layer or layers:

NameEquation, Derivatives, Range Order of continuity
Softmax    for i = 1, …, J
Maxout [24]
^ Here, is the Kronecker delta.
^ For instance, could be iterating through the number of kernels of the previous neural network layer while iterates through the number of kernels of the current layer.

Quantum activation functions

In quantum neural networks programmed on gate-model quantum computers, based on quantum perceptrons instead of variational quantum circuits, the non-linearity of the activation function can be implemented with no need of measuring the output of each perceptron at each layer. The quantum properties loaded within the circuit such as superposition can be preserved by creating the Taylor series of the argument computed by the perceptron itself, with suitable quantum circuits computing the powers up to a wanted approximation degree. Because of the flexibility of such quantum circuits, they can be designed in order to approximate any arbitrary classical activation function. [25]

See also

Related Research Articles

<span class="mw-page-title-main">Neural network (machine learning)</span> Computational model used in machine learning, based on connected, hierarchical functions

In machine learning, a neural network is a model inspired by the structure and function of biological neural networks in animal brains.

<span class="mw-page-title-main">Artificial neuron</span> Mathematical function conceived as a crude model

An artificial neuron is a mathematical function conceived as a model of a biological neuron in a neural network. The artificial neuron is the elementary unit of an artificial neural network.

In machine learning, backpropagation is a gradient estimation method commonly used for training a neural network to compute its parameter updates.

<span class="mw-page-title-main">Feedforward neural network</span> Type of artificial neural network

A feedforward neural network (FNN) is one of the two broad types of artificial neural network, characterized by direction of the flow of information between its layers. Its flow is uni-directional, meaning that the information in the model flows in only one direction—forward—from the input nodes, through the hidden nodes and to the output nodes, without any cycles or loops. Modern feedforward networks are trained using backpropagation, and are colloquially referred to as "vanilla" neural networks.

In deep learning, a multilayer perceptron (MLP) is a name for a modern feedforward neural network consisting of fully connected neurons with nonlinear activation functions, organized in layers, notable for being able to distinguish data that is not linearly separable.

<span class="mw-page-title-main">Quantum neural network</span> Quantum Mechanics in Neural Networks

Quantum neural networks are computational neural network models which are based on the principles of quantum mechanics. The first ideas on quantum neural computation were published independently in 1995 by Subhash Kak and Ron Chrisley, engaging with the theory of quantum mind, which posits that quantum effects play a role in cognitive function. However, typical research in quantum neural networks involves combining classical artificial neural network models with the advantages of quantum information in order to develop more efficient algorithms. One important motivation for these investigations is the difficulty to train classical neural networks, especially in big data applications. The hope is that features of quantum computing such as quantum parallelism or the effects of interference and entanglement can be used as resources. Since the technological implementation of a quantum computer is still in a premature stage, such quantum neural network models are mostly theoretical proposals that await their full implementation in physical experiments.

<span class="mw-page-title-main">Autoencoder</span> Neural network that learns efficient data encoding in an unsupervised manner

An autoencoder is a type of artificial neural network used to learn efficient codings of unlabeled data. An autoencoder learns two functions: an encoding function that transforms the input data, and a decoding function that recreates the input data from the encoded representation. The autoencoder learns an efficient representation (encoding) for a set of data, typically for dimensionality reduction, to generate lower-dimensional embeddings for subsequent use by other machine learning algorithms.

In the mathematical theory of artificial neural networks, universal approximation theorems are theorems of the following form: Given a family of neural networks, for each function from a certain function space, there exists a sequence of neural networks from the family, such that according to some criterion. That is, the family of neural networks is dense in the function space.

There are many types of artificial neural networks (ANN).

<span class="mw-page-title-main">Restricted Boltzmann machine</span> Class of artificial neural network

A restricted Boltzmann machine (RBM) is a generative stochastic artificial neural network that can learn a probability distribution over its set of inputs.

<span class="mw-page-title-main">Rectifier (neural networks)</span> Type of activation function

In the context of artificial neural networks, the rectifier or ReLU activation function is an activation function defined as the non-negative part of its argument, i.e., the ramp function:

A convolutional neural network (CNN) is a regularized type of feed-forward neural network that learns features by itself via filter optimization. This type of deep learning network has been applied to process and make predictions from many different types of data including text, images and audio. Convolution-based networks are the de-facto standard in deep learning-based approaches to computer vision and image processing, and have only recently been replaced -- in some cases -- by newer deep learning architectures such as the transformer. Vanishing gradients and exploding gradients, seen during backpropagation in earlier neural networks, are prevented by using regularized weights over fewer connections. For example, for each neuron in the fully-connected layer, 10,000 weights would be required for processing an image sized 100 × 100 pixels. However, applying cascaded convolution kernels, only 25 neurons are required to process 5x5-sized tiles. Higher-layer features are extracted from wider context windows, compared to lower-layer features.

In machine learning, the vanishing gradient problem is encountered when training neural networks with gradient-based learning methods and backpropagation. In such methods, during each training iteration, each neural network weight receives an update proportional to the partial derivative of the loss function with respect to the current weight. The problem is that as the network depth or sequence length increases, the gradient magnitude typically is expected to decrease, slowing the training process. In the worst case, this may completely stop the neural network from further learning. As one example of this problem, traditional activation functions such as the hyperbolic tangent function have gradients in the range [-1,1], and backpropagation computes gradients using the chain rule. This has the effect of multiplying n of these small numbers to compute gradients of the early layers in an n-layer network, meaning that the gradient decreases exponentially with n while the early layers train very slowly.

In machine learning, the Highway Network was the first working very deep feedforward neural network with hundreds of layers, much deeper than previous neural networks. It uses skip connections modulated by learned gating mechanisms to regulate information flow, inspired by long short-term memory (LSTM) recurrent neural networks. The advantage of the Highway Network over other deep learning architectures is its ability to overcome or partially prevent the vanishing gradient problem, thus improving its optimization. Gating mechanisms are used to facilitate information flow across the many layers.

<span class="mw-page-title-main">Residual neural network</span> Type of artificial neural network

A residual neural network is a deep learning architecture in which the layers learn residual functions with reference to the layer inputs. It was developed in 2015 for image recognition, and won the ImageNet Large Scale Visual Recognition Challenge of that year.

Batch normalization is a method used to make training of artificial neural networks faster and more stable through normalization of the layers' inputs by re-centering and re-scaling. It was proposed by Sergey Ioffe and Christian Szegedy in 2015.

A Neural Network Gaussian Process (NNGP) is a Gaussian process (GP) obtained as the limit of a certain type of sequence of neural networks. Specifically, a wide variety of network architectures converges to a GP in the infinitely wide limit, in the sense of distribution. The concept constitutes an intensional definition, i.e., a NNGP is just a GP, but distinguished by how it is obtained.

Graph neural networks (GNN) are specialized artificial neural networks that are designed for tasks whose inputs are graphs.

Neural operators are a class of deep learning architectures designed to learn maps between infinite-dimensional function spaces. Neural operators represent an extension of traditional artificial neural networks, marking a departure from the typical focus on learning mappings between finite-dimensional Euclidean spaces or finite sets. Neural operators directly learn operators between function spaces; they can receive input functions, and the output function can be evaluated at any discretization.

In deep learning, weight initialization describes the initial step in creating a neural network. A neural network contains trainable parameters that are modified during training: weight initialization is the pre-training step of assigning initial values to these parameters.

References

  1. Hinkelmann, Knut. "Neural Networks, p. 7" (PDF). University of Applied Sciences Northwestern Switzerland. Archived from the original (PDF) on 2018-10-06. Retrieved 2018-10-06.
  2. 1 2 3 Hendrycks, Dan; Gimpel, Kevin (2016). "Gaussian Error Linear Units (GELUs)". arXiv: 1606.08415 [cs.LG].
  3. Hinton, Geoffrey; Deng, Li; Deng, Li; Yu, Dong; Dahl, George; Mohamed, Abdel-rahman; Jaitly, Navdeep; Senior, Andrew; Vanhoucke, Vincent; Nguyen, Patrick; Sainath, Tara; Kingsbury, Brian (2012). "Deep Neural Networks for Acoustic Modeling in Speech Recognition". IEEE Signal Processing Magazine. 29 (6): 82–97. doi:10.1109/MSP.2012.2205597. S2CID   206485943.
  4. Krizhevsky, Alex; Sutskever, Ilya; Hinton, Geoffrey E. (2017-05-24). "ImageNet classification with deep convolutional neural networks". Communications of the ACM. 60 (6): 84–90. doi:10.1145/3065386. ISSN   0001-0782.
  5. King Abdulaziz University; Al-johania, Norah; Elrefaei, Lamiaa; Benha University (2019-06-30). "Dorsal Hand Vein Recognition by Convolutional Neural Networks: Feature Learning and Transfer Learning Approaches" (PDF). International Journal of Intelligent Engineering and Systems. 12 (3): 178–191. doi:10.22266/ijies2019.0630.19.
  6. Cybenko, G. (December 1989). "Approximation by superpositions of a sigmoidal function" (PDF). Mathematics of Control, Signals, and Systems. 2 (4): 303–314. Bibcode:1989MCSS....2..303C. doi:10.1007/BF02551274. ISSN   0932-4194. S2CID   3958369.
  7. Snyman, Jan (3 March 2005). Practical Mathematical Optimization: An Introduction to Basic Optimization Theory and Classical and New Gradient-Based Algorithms. Springer Science & Business Media. ISBN   978-0-387-24348-1.
  8. Krizhevsky, Alex; Sutskever, Ilya; Hinton, Geoffrey E. (2017-05-24). "ImageNet classification with deep convolutional neural networks". Communications of the ACM. 60 (6): 84–90. doi: 10.1145/3065386 . ISSN   0001-0782. S2CID   195908774.
  9. Hodgkin, A. L.; Huxley, A. F. (1952-08-28). "A quantitative description of membrane current and its application to conduction and excitation in nerve". The Journal of Physiology. 117 (4): 500–544. doi:10.1113/jphysiol.1952.sp004764. PMC   1392413 . PMID   12991237.
  10. Sitzmann, Vincent; Martel, Julien; Bergman, Alexander; Lindell, David; Wetzstein, Gordon (2020). "Implicit Neural Representations with Periodic Activation Functions". Advances in Neural Information Processing Systems. 33. Curran Associates, Inc.: 7462–7473. arXiv: 2006.09661 .
  11. Flake, Gary William (1998), Orr, Genevieve B.; Müller, Klaus-Robert (eds.), "Square Unit Augmented Radially Extended Multilayer Perceptrons", Neural Networks: Tricks of the Trade, Lecture Notes in Computer Science, vol. 1524, Berlin, Heidelberg: Springer, pp. 145–163, doi:10.1007/3-540-49430-8_8, ISBN   978-3-540-49430-0 , retrieved 2024-10-05
  12. Du, Simon; Lee, Jason (2018-07-03). "On the Power of Over-parametrization in Neural Networks with Quadratic Activation". Proceedings of the 35th International Conference on Machine Learning. PMLR: 1329–1338. arXiv: 1803.01206 .
  13. Nair, Vinod; Hinton, Geoffrey E. (2010), "Rectified Linear Units Improve Restricted Boltzmann Machines", 27th International Conference on International Conference on Machine Learning, ICML'10, USA: Omnipress, pp. 807–814, ISBN   9781605589077
  14. Glorot, Xavier; Bordes, Antoine; Bengio, Yoshua (2011). "Deep sparse rectifier neural networks" (PDF). International Conference on Artificial Intelligence and Statistics.
  15. Clevert, Djork-Arné; Unterthiner, Thomas; Hochreiter, Sepp (2015-11-23). "Fast and Accurate Deep Network Learning by Exponential Linear Units (ELUs)". arXiv: 1511.07289 [cs.LG].
  16. Klambauer, Günter; Unterthiner, Thomas; Mayr, Andreas; Hochreiter, Sepp (2017-06-08). "Self-Normalizing Neural Networks". Advances in Neural Information Processing Systems. 30 (2017). arXiv: 1706.02515 .
  17. Maas, Andrew L.; Hannun, Awni Y.; Ng, Andrew Y. (June 2013). "Rectifier nonlinearities improve neural network acoustic models". Proc. ICML. 30 (1). S2CID   16489696.
  18. He, Kaiming; Zhang, Xiangyu; Ren, Shaoqing; Sun, Jian (2015-02-06). "Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification". arXiv: 1502.01852 [cs.CV].
  19. Atto, Abdourrahmane M.; Galichet, Sylvie; Pastor, Dominique; Méger, Nicolas (2023), "On joint parameterizations of linear and nonlinear functionals in neural networks", Elsevier Pattern Recognition, vol. 160, pp. 12–21, doi:10.1016/j.neunet.2022.12.019, PMID   36592526
  20. Atto, Abdourrahmane M.; Pastor, Dominique; Mercier, Grégoire (2008), "Smooth sigmoid wavelet shrinkage for non-parametric estimation" (PDF), 2008 IEEE International Conference on Acoustics, Speech and Signal Processing , pp. 3265–3268, doi:10.1109/ICASSP.2008.4518347, ISBN   978-1-4244-1483-3, S2CID   9959057
  21. Elfwing, Stefan; Uchibe, Eiji; Doya, Kenji (2018). "Sigmoid-Weighted Linear Units for Neural Network Function Approximation in Reinforcement Learning". Neural Networks. 107: 3–11. arXiv: 1702.03118 . doi:10.1016/j.neunet.2017.12.012. PMID   29395652. S2CID   6940861.
  22. Ramachandran, Prajit; Zoph, Barret; Le, Quoc V (2017). "Searching for Activation Functions". arXiv: 1710.05941 [cs.NE].
  23. Basirat, Mina; Roth, Peter M. (2018-08-02), The Quest for the Golden Activation Function, arXiv: 1808.00783
  24. Goodfellow, Ian J.; Warde-Farley, David; Mirza, Mehdi; Courville, Aaron; Bengio, Yoshua (2013). "Maxout Networks". JMLR Workshop and Conference Proceedings. 28 (3): 1319–1327. arXiv: 1302.4389 .
  25. Maronese, Marco; Destri, Claudio; Prati, Enrico (2022). "Quantum activation functions for quantum neural networks". Quantum Information Processing. 21 (4): 128. arXiv: 2201.03700 . Bibcode:2022QuIP...21..128M. doi:10.1007/s11128-022-03466-0. ISSN   1570-0755.

Further reading