Activation function

From HandWiki
Short description: Artificial neural network node function
Logistic 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.[1]

Modern activation functions include the logistic (sigmoid) function used in the 2012 speech recognition model developed by Hinton et al;[2] the ReLU used in the 2012 AlexNet computer vision model[3][4] and in the 2015 ResNet model; and the smooth version of the ReLU, the GELU, which was used in the 2018 BERT model.[5]

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.
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.[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 f is saturating if lim|v||f(v)|=0. It is nonsaturating if lim|v||f(v)|0. 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]

  • Linear activation: ϕ(𝐯)=a+𝐯𝐛,
  • ReLU activation: ϕ(𝐯)=max(0,a+𝐯𝐛),
  • Heaviside activation: ϕ(𝐯)=1a+𝐯𝐛>0,
  • Logistic activation: ϕ(𝐯)=(1+exp(a𝐯𝐛))1.

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 ϕ(𝐯)=U(a+𝐯𝐛), where U 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 ϕ(𝐯)=a+𝐯𝐛.

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:

  • Gaussian: ϕ(𝐯)=exp(𝐯𝐜22σ2)
  • Multiquadratics: ϕ(𝐯)=𝐯𝐜2+a2
  • Inverse multiquadratics: ϕ(𝐯)=(𝐯𝐜2+a2)12
  • Polyharmonic splines

where 𝐜 is the vector representing the function center and a 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 xx2.[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:

Name Plot Function, g(x) Derivative of g, g(x) Range Order of continuity
Identity File:Activation identity.svg x 1 (,) C
Binary step File:Activation binary step.svg {0if x<01if x0 0 {0,1} C1
Logistic, sigmoid, or soft step File:Activation logistic.svg σ(x)11+ex g(x)(1g(x)) (0,1) C
Hyperbolic tangent (tanh) File:Activation tanh.svg tanh(x)exexex+ex 1g(x)2 (1,1) C
Soboleva modified hyperbolic tangent (smht) File:SMHTAF size.png smht(x)eaxebxecx+edx (1,1) C
Softsign x1+|x| 1(1+|x|)2 (1,1) C1
Rectified linear unit (ReLU)[13] File:Activation rectified linear.svg (x)+{0if x0xif x>0=max(0,x)=x1x>0 {0if x<01if x>0 [0,) C0
Gaussian Error Linear Unit (GELU)[5] Visualization of the Gaussian Error Linear Unit (GELU) 12x(1+erf(x2))=xΦ(x) where erf is the gaussian error function. Φ(x)+12xϕ(x) where ϕ(x)=12πe12x2 is the probability density function of standard gaussian distribution. (0.17,) C
Softplus[14] File:Activation softplus.svg ln(1+ex) 11+ex (0,) C
Exponential linear unit (ELU)[15] File:Activation elu.svg {α(ex1)if x0xif x>0
with parameter α
{αexif x<01if x>0 (α,) {C1if α=1C0otherwise
Scaled exponential linear unit (SELU)[16] File:Activation selu.png λ{α(ex1)if x<0xif x0
with parameters λ=1.0507 and α=1.67326
λ{αexif x<01if x0 (λα,) C0
Leaky rectified linear unit (Leaky ReLU)[17] File:Activation prelu.svg {0.01xif x0xif x>0 {0.01if x<01if x>0 (,) C0
Parametric rectified linear unit (PReLU)[18] File:Activation prelu.svg {αxif x<0xif x0
with parameter α
{αif x<01if x0 (,) C0
Rectified Parametric Sigmoid Units (flexible, 5 parameters) 120px α(2x1{xλ}gλ,σ,μ,β(x))+(1α)gλ,σ,μ,β(x)

where gλ,σ,μ,β(x)=(xλ)1{xλ}1+esgn(xμ)(|xμ|σ)β [19]

(,+) C0
Sigmoid linear unit (SiLU,[5] Sigmoid shrinkage,[20] SiL,[21] or Swish-‍1[22]) Swish Activation Function x1+ex 1+ex+xex(1+ex)2 [0.278,) C
Exponential Linear Sigmoid SquasHing (ELiSH)[23] 100px {ex11+exif x<0x1+exif x0 {2e2x+e3xexe2x+2ex+1if x<0xex+e2x+exe2x+2ex+1if x0 [0.881,) C1
Gaussian File:Activation gaussian.svg ex2 2xex2 (0,1] C
Sinusoid sinx cosx [1,1] C

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

Name Equation, gi(x) Derivatives, gi(x)xj Range Order of continuity
Softmax exij=1Jexj    for i = 1, …, J gi(x)(δijgj(x))[1][2] (0,1) C
Maxout[24] maxixi {1if j=argmaxixi0if jargmaxixi (,) C0
^ Here, δ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.

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

References

  1. Hinkelmann, Knut. "Neural Networks, p. 7". http://didattica.cs.unicam.it/lib/exe/fetch.php?media=didattica:magistrale:kebi:ay_1718:ke-11_neural_networks.pdf. 
  2. Hinton, Geoffrey; Deng, Li; Deng, Li; Yu, Dong; Dahl, George; Mohamed, Abdel-rahman; Jaitly, Navdeep; Senior, Andrew et al. (2012). "Deep Neural Networks for Acoustic Modeling in Speech Recognition". IEEE Signal Processing Magazine 29 (6): 82–97. doi:10.1109/MSP.2012.2205597. 
  3. Krizhevsky, Alex; Sutskever, Ilya; Hinton, Geoffrey E. (24 May 2017). "ImageNet classification with deep convolutional neural networks" (in en). Communications of the ACM 60 (6): 84–90. doi:10.1145/3065386. ISSN 0001-0782. https://dl.acm.org/doi/10.1145/3065386. 
  4. King Abdulaziz University; Al-johania, Norah; Elrefaei, Lamiaa; Benha University (30 June 2019). "Dorsal Hand Vein Recognition by Convolutional Neural Networks: Feature Learning and Transfer Learning Approaches". International Journal of Intelligent Engineering and Systems 12 (3): 178–191. doi:10.22266/ijies2019.0630.19. http://www.inass.org/2019/2019063019.pdf. 
  5. 5.0 5.1 5.2 Hendrycks, Dan; Gimpel, Kevin (2016). "Gaussian Error Linear Units (GELUs)". arXiv:1606.08415 [cs.LG].
  6. Cybenko, G. (December 1989). "Approximation by superpositions of a sigmoidal function" (in en). Mathematics of Control, Signals, and Systems 2 (4): 303–314. doi:10.1007/BF02551274. ISSN 0932-4194. Bibcode1989MCSS....2..303C. https://hal.archives-ouvertes.fr/hal-03753170/file/Cybenko1989.pdf. 
  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. https://books.google.com/books?id=0tFmf_UKl7oC. 
  8. Krizhevsky, Alex; Sutskever, Ilya; Hinton, Geoffrey E. (24 May 2017). "ImageNet classification with deep convolutional neural networks". Communications of the ACM 60 (6): 84–90. doi:10.1145/3065386. ISSN 0001-0782. 
  9. Hodgkin, A. L.; Huxley, A. F. (28 August 1952). "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. 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 (Curran Associates, Inc.) 33: 7462–7473. https://proceedings.neurips.cc/paper/2020/hash/53c04118df112c13a8c34b38343b9c10-Abstract.html. 
  11. Flake, Gary William (1998), Orr, Genevieve B.; Müller, Klaus-Robert, eds., "Square Unit Augmented Radially Extended Multilayer Perceptrons" (in en), Neural Networks: Tricks of the Trade, Lecture Notes in Computer Science (Berlin, Heidelberg: Springer) 1524: pp. 145–163, doi:10.1007/3-540-49430-8_8, ISBN 978-3-540-49430-0, https://link.springer.com/chapter/10.1007/3-540-49430-8_8, retrieved 5 October 2024 
  12. Du, Simon; Lee, Jason (3 July 2018). "On the Power of Over-parametrization in Neural Networks with Quadratic Activation" (in en). Proceedings of the 35th International Conference on Machine Learning (PMLR): 1329–1338. https://proceedings.mlr.press/v80/du18a.html. 
  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, http://dl.acm.org/citation.cfm?id=3104322.3104425 
  14. Glorot, Xavier; Bordes, Antoine; Bengio, Yoshua (2011). "Deep sparse rectifier neural networks". http://proceedings.mlr.press/v15/glorot11a/glorot11a.pdf. 
  15. Clevert, Djork-Arné; Unterthiner, Thomas; Hochreiter, Sepp (23 November 2015). "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 (8 June 2017). "Self-Normalizing Neural Networks". Advances in Neural Information Processing Systems 30 (2017). 
  17. Maas, Andrew L.; Hannun, Awni Y.; Ng, Andrew Y. (June 2013). "Rectifier nonlinearities improve neural network acoustic models". Proc. ICML 30 (1). 
  18. He, Kaiming; Zhang, Xiangyu; Ren, Shaoqing; Sun, Jian (6 February 2015). "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, 160, pp. 12–21, doi:10.1016/j.neunet.2022.12.019, PMID 36592526, https://doi.org/10.1016/j.neunet.2022.12.019 
  20. Atto, Abdourrahmane M.; Pastor, Dominique; Mercier, Grégoire (2008), "Smooth sigmoid wavelet shrinkage for non-parametric estimation", 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, https://hal.archives-ouvertes.fr/hal-02136546/file/ICASSP_ATTO_2008.pdf 
  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. doi:10.1016/j.neunet.2017.12.012. PMID 29395652. 
  22. Ramachandran, Prajit; Zoph, Barret; Le, Quoc V (2017). "Searching for Activation Functions". arXiv:1710.05941 [cs.NE].
  23. Basirat, Mina; Roth, Peter M. (2 August 2018), The Quest for the Golden Activation Function 
  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. 
  25. Maronese, Marco; Destri, Claudio; Prati, Enrico (2022). "Quantum activation functions for quantum neural networks". Quantum Information Processing 21 (4): 128. doi:10.1007/s11128-022-03466-0. ISSN 1570-0755. Bibcode2022QuIP...21..128M. 

Further reading

  • Kunc, Vladimír; Kléma, Jiří (14 February 2024), Three Decades of Activations: A Comprehensive Survey of 400 Activation Functions for Neural Networks 
  • Nwankpa, Chigozie; Ijomah, Winifred; Gachagan, Anthony; Marshall, Stephen (8 November 2018). "Activation Functions: Comparison of trends in Practice and Research for Deep Learning". arXiv:1811.03378 [cs.LG].
  • Dubey, Shiv Ram; Singh, Satish Kumar; Chaudhuri, Bidyut Baran (2022). "Activation functions in deep learning: A comprehensive survey and benchmark". Neurocomputing (Elsevier BV) 503: 92–108. doi:10.1016/j.neucom.2022.06.111. ISSN 0925-2312. 

Template:Artificial intelligence navbox