Content deleted Content added
m Fixing broken anchor: #Order of continuity→most alike anchor Smoothness#Continuity |
|||
(27 intermediate revisions by 14 users not shown) | |||
Line 2:
{{About||the formalism used to approximate the influence of an extracellular electrical field on neurons|activating function|a linear system’s transfer function|transfer function}}
{{Machine learning}}
{{Use dmy dates|date=August 2025}}
[[File:Logistic-curve.svg|thumb|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''.<ref>{{Cite web|url=http://didattica.cs.unicam.it/lib/exe/fetch.php?media=didattica:magistrale:kebi:ay_1718:ke-11_neural_networks.pdf|title=Neural Networks, p. 7|last=Hinkelmann|first=Knut|website=University of Applied Sciences Northwestern Switzerland|access-date=6 October 2018
Modern activation functions include ==Comparison of activation functions==
Line 10 ⟶ 13:
; Nonlinear: When the activation function is non-linear, then a two-layer neural network can be proven to be a universal function approximator.<ref>{{Cite journal|author1-link=George Cybenko|last=Cybenko|first=G.|date=December 1989|title=Approximation by superpositions of a sigmoidal function|journal=Mathematics of Control, Signals, and Systems|language=en|volume=2|issue=4|pages=303–314|doi=10.1007/BF02551274|bibcode=1989MCSS....2..303C |s2cid=3958369|issn=0932-4194|url=https://hal.archives-ouvertes.fr/hal-03753170/file/Cybenko1989.pdf }}</ref> This is known as the [[Universal approximation theorem|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 rate]]s are typically necessary.{{citation needed|date=January 2016}}
; Continuously differentiable: This property is desirable for enabling gradient-based optimization methods ([[Rectifier (neural networks)|ReLU]] is not continuously differentiable and has some issues with gradient-based optimization, but it is still possible)
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 [[Autoencoder#Variational autoencoder (VAE)|variational autoencoders]].
== Mathematical details ==
The most common activation functions can be divided into three categories: [[ridge function]]s, [[radial function]]s and [[fold function]]s.
An activation function <math>f</math> is '''saturating''' if <math>\lim_{|v|\to \infty} |\nabla f(v)| = 0</math>. It is '''nonsaturating''' if
=== Ridge activation functions ===
Line 28 ⟶ 31:
* [[logistic function|Logistic]] activation: <math>\phi(\mathbf v) = (1+\exp(-a-\mathbf v'\mathbf b))^{-1}</math>.
In [[Biological neural network|biologically inspired neural networks]], the activation function is usually an abstraction representing the rate of [[action potential]] firing in the cell.<ref>{{Cite journal|last1=Hodgkin|first1=A. L.|last2=Huxley|first2=A. F.|date=
The function looks like <math>\phi(\mathbf v)=U(a + \mathbf v'\mathbf b)</math>, where <math>U</math> is the [[Heaviside step function]].
Line 48 ⟶ 51:
Periodic functions can serve as activation functions. Usually the [[Sine wave|sinusoid]] is used, as any periodic function is decomposable into sinusoids by the [[Fourier transform]].<ref>{{Cite journal |last1=Sitzmann |first1=Vincent |last2=Martel |first2=Julien |last3=Bergman |first3=Alexander |last4=Lindell |first4=David |last5=Wetzstein |first5=Gordon |date=2020 |title=Implicit Neural Representations with Periodic Activation Functions |url=https://proceedings.neurips.cc/paper/2020/hash/53c04118df112c13a8c34b38343b9c10-Abstract.html |journal=Advances in Neural Information Processing Systems |publisher=Curran Associates, Inc. |volume=33 |pages=7462–7473|arxiv=2006.09661 }}</ref>
Quadratic activation maps <math>x \mapsto x^2</math>.<ref>{{Citation |last=Flake |first=Gary William |title=Square Unit Augmented Radially Extended Multilayer Perceptrons |date=1998 |work=Neural Networks: Tricks of the Trade |series=Lecture Notes in Computer Science |volume=1524 |pages=145–163 |editor-last=Orr |editor-first=Genevieve B. |url=https://link.springer.com/chapter/10.1007/3-540-49430-8_8 |access-date=5 October 2024
=== Folding activation functions ===
{{Main|Fold function}}
Folding activation functions are extensively used in the [[Pooling layer|pooling layers]] in [[convolutional neural network]]s, and in output layers of [[multiclass classification]] networks. These activations perform [[Aggregate function|aggregation]] over the inputs, such as taking the [[mean]], [[minimum]] or [[maximum]]. In multiclass classification the [[Softmax function|softmax]] activation is often used.
=== Table of activation functions ===
Line 102 ⟶ 105:
| <math>(-1,1)</math>
| <math>C^\infty</math>
|-
|Softsign
|
|<math>\frac{1}{(1+|x|)^2}</math>
|<math>(-1, 1)</math>
|<math>C^1</math>
|-
| [[Rectifier (neural networks)|Rectified linear unit]] (ReLU)<ref>{{Citation|last1=Nair|first1=Vinod|last2=Hinton|first2=Geoffrey E.|date=2010|contribution=Rectified Linear Units Improve Restricted Boltzmann Machines|contribution-url=http://dl.acm.org/citation.cfm?id=3104322.3104425|title=27th International Conference on International Conference on Machine Learning|series=ICML'10|___location=USA|publisher=Omnipress|pages=807–814|isbn=9781605589077}}</ref>
Line 124 ⟶ 134:
&\frac{1}{2} x \left(1 + \text{erf}\left(\frac{x}{\sqrt{2}}\right)\right) \\
{}={} &x\Phi(x)
\end{align}</math> where <math>\mathrm{erf}</math> is the [[Error function|gaussian error function]].
| <math>\Phi(x) + \frac 12 x\phi(x)</math> where <math>\phi(x) = \frac{1}{\sqrt{2\pi}} e^{-\frac 12 x^2}</math> is the probability density function of standard gaussian distribution.
▲| <math>\Phi(x) + x\phi(x)</math>
| <math>(-0.17\ldots, \infty)</math>
| <math>C^\infty</math>
|-
| [[Softplus]]<ref>{{Cite web|url=http://proceedings.mlr.press/v15/glorot11a/glorot11a.pdf|title=Deep sparse rectifier neural networks|last1=Glorot|first1=Xavier|last2=Bordes|first2=Antoine|date=2011|website=International Conference on Artificial Intelligence and Statistics|last3=Bengio|first3=Yoshua}}</ref>
| [[File:Activation softplus.svg]]
| <math>\ln\left(1 + e^x\right)</math>
Line 136 ⟶ 146:
| <math>C^\infty</math>
|-
| [[Rectifier (neural networks)#ELU|Exponential linear unit (ELU)]]<ref>{{Cite arXiv|last1=Clevert|first1=Djork-Arné|last2=Unterthiner|first2=Thomas|last3=Hochreiter|first3=Sepp|date=
| [[File:Activation elu.svg]]
| <math>\begin{cases}
Line 153 ⟶ 163:
\end{cases}</math>
|-
| Scaled exponential linear unit (SELU)<ref>{{Cite journal |last1=Klambauer |first1=Günter |last2=Unterthiner |first2=Thomas |last3=Mayr |first3=Andreas |last4=Hochreiter |first4=Sepp |date=8 June 2017
| [[File:Activation selu.png]]
| <math>\lambda \begin{cases}
Line 167 ⟶ 177:
| <math>C^0</math>
|-
| Leaky rectified linear unit (Leaky ReLU)<ref>{{cite journal |last1=Maas |first1=Andrew L. |last2=Hannun |first2=Awni Y. |last3=Ng |first3=Andrew Y. |s2cid=16489696 |title=Rectifier nonlinearities improve neural network acoustic models |journal=Proc. ICML |date=June 2013 |volume=30 |issue=1}}</ref>
| [[File:Activation prelu.svg]]
| <math>\begin{cases}
Line 180 ⟶ 190:
| <math>C^0</math>
|-
| Parametric rectified linear unit (PReLU)<ref>{{Cite arXiv |last1=He |first1=Kaiming |last2=Zhang |first2=Xiangyu |last3=Ren |first3=Shaoqing |last4=Sun |first4=Jian |date=6 February 2015
| [[File:Activation prelu.svg]]
| <math>\begin{cases}
Line 199 ⟶ 209:
where
<math>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 } } </math>
<ref name="refrepsu1">
{{Citation
|first1=Abdourrahmane M.|last1=Atto|first2=Sylvie|last2=Galichet|first3=Dominique|last3=Pastor|first4=Nicolas|last4=Méger
Line 206 ⟶ 216:
|title = Elsevier Pattern Recognition
|date = 2023
|volume=160 |pages=12–21 |doi=10.1016/j.neunet.2022.12.019 |pmid=36592526 |arxiv=2101.09948}}</ref>
| <math> - </math>
| <math>(-\infty,+\infty)</math>
| <math>C^0</math>
|-
| [[Rectifier (neural networks)#SiLU|Sigmoid linear unit]] (SiLU,<ref name="ReferenceA" /> Sigmoid shrinkage,<ref name="refssbs1">
{{Citation
|first1=Abdourrahmane M.|last1=Atto|first2=Dominique|last2=Pastor|first3=Grégoire|last3=Mercier
Line 218 ⟶ 228:
|title = [[2008 IEEE International Conference on Acoustics, Speech and Signal Processing]]
|date = 2008
|pages=3265–3268 |doi=10.1109/ICASSP.2008.4518347|isbn=978-1-4244-1483-3 |s2cid=9959057}}</ref> SiL,<ref>{{Cite journal |arxiv = 1702.03118|title = Sigmoid-Weighted Linear Units for Neural Network Function Approximation in Reinforcement Learning|journal = Neural Networks |volume = 107|pages = 3–11|last1 = Elfwing|first1 = Stefan|last2 = Uchibe|first2 = Eiji|last3 = Doya|first3 = Kenji|year = 2018|pmid = 29395652|doi = 10.1016/j.neunet.2017.12.012|s2cid = 6940861}}</ref> or [[Swish function|Swish]]-{{zwj}}1<ref>{{Cite arXiv |eprint = 1710.05941 |title = Searching for Activation Functions|last1 = Ramachandran|first1 = Prajit|last2 = Zoph|first2 = Barret|last3 = Le|first3 = Quoc V|year = 2017|class = cs.NE}}</ref>)
| [[File:Swish.svg|Swish Activation Function|120px]]
| <math>\frac{x}{1 + e^{-x}}</math>
Line 225 ⟶ 235:
| <math>C^\infty</math>
|-
|Exponential Linear Sigmoid SquasHing (ELiSH)<ref>{{Citation |last1=Basirat |first1=Mina |title=The Quest for the Golden Activation Function |date=2 August 2018
|[[File:Elish_activation_function.png|thumb|An image of the ELiSH activation function plotted over the range [-3, 3] with a minumum value of ~0.881 at x ~= -0.172
|<math>\begin{cases}
\frac{e^x - 1}{1 + e^{-x}} & \text{if } x < 0 \\
Line 293 ⟶ 303:
== Further reading ==
* {{
* {{cite arXiv |last1=Nwankpa |first1=Chigozie |title=Activation Functions: Comparison of trends in Practice and Research for Deep Learning |date=8 November 2018 |eprint=1811.03378 |last2=Ijomah |first2=Winifred |last3=Gachagan |first3=Anthony |last4=Marshall |first4=Stephen|class=cs.LG }}
* {{cite journal |last1=Dubey |first1=Shiv Ram |last2=Singh |first2=Satish Kumar |last3=Chaudhuri |first3=Bidyut Baran |year=2022 |title=Activation functions in deep learning: A comprehensive survey and benchmark |journal=Neurocomputing |publisher=Elsevier BV |volume=503 |pages=92–108 |doi=10.1016/j.neucom.2022.06.111 |issn=0925-2312 |doi-access=free|arxiv=2109.14545 }}
|