Activation function: Difference between revisions
Notation: number of layers is N (via update-page on MediaWiki MCP Server) |
|||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
[[Category: | [[Category:Artificial neural network]][[Category:Special function]] | ||
[[Category: | An '''activation function''' is a mathematical [[function]]. | ||
An '''activation function''' is | |||
It is part of layer-to-layer '''feedforward mechanisms''' of an [[artificial neural network (ANN)]]. | |||
* For a simple [[ANN]],the [[feedforward algorithm]] | |||
* For a [[Transformer]], the [[feed-Forward Network (FFN) Sub-Layer (Transformer)|Feed-Forward Network (FFN)]] | |||
== Formal definition == | |||
= | |||
An activation function is any component-wise real-vector map | |||
An activation function is any | |||
$$ | $$ | ||
\sigma:\mathbb{R}\to\mathbb{R} | \sigma:\mathbb{R}^n\to\mathbb{R}^n | ||
$$ | $$ | ||
so for any '''pre-activation vector''' $\vec z = (z_1,z_2,\dots,z_n)$ of [[artificial neuron#Layer_composition|a layer of artificial neurons]]: | |||
$$ | $$ | ||
\text{Activation vector}:\sigma(\vec z)=(\sigma(z_1),\sigma(z_2),\dots,\sigma(z_n)) | |||
$$ | $$ | ||
== Importance == | |||
'''Without''' an activation function: | |||
$$ | $$ | ||
\ | \mathbf{W}_2\left(\mathbf{W}_1\vec x+\vec b_1\right)+\vec b_2 | ||
= | |||
\mathbf{W}\vec x+\vec b, | |||
\qquad | |||
\mathbf{W}=\mathbf{W}_2\mathbf{W}_1, | |||
\quad | |||
\vec b=\mathbf{W}_2\vec b_1+\vec b_2, | |||
$$ | $$ | ||
Hence, any number of layers of [[artificial neuron]]s is strictly equivalent to 1 larger layer, a phenomenon known as '''depth collapse'''. | |||
The activation function, which introduces '''non-linearity''', enables the preservation of depth of an [[ANN]]. | |||
== Common variants == | |||
* [[(leaky) rectified/exponential linear units (ReLU, LeakyReLU, ELU)]] | |||
* [[sigmoid function]] | |||
* [[sigmoid linear unit (SLU)]] | |||
* [[gated linear unit (GLU)]] | |||
* [[hyperbolic tangent]] | |||
* [[Gaussian error linear unit (GeLU)]] | |||
Latest revision as of 15:46, 16 November 2026
An activation function is a mathematical function.
It is part of layer-to-layer feedforward mechanisms of an artificial neural network (ANN).
- For a simple ANN,the feedforward algorithm
- For a Transformer, the Feed-Forward Network (FFN)
Formal definition
An activation function is any component-wise real-vector map
$$ \sigma:\mathbb{R}^n\to\mathbb{R}^n $$
so for any pre-activation vector $\vec z = (z_1,z_2,\dots,z_n)$ of a layer of artificial neurons:
$$ \text{Activation vector}:\sigma(\vec z)=(\sigma(z_1),\sigma(z_2),\dots,\sigma(z_n)) $$
Importance
Without an activation function:
$$ \mathbf{W}_2\left(\mathbf{W}_1\vec x+\vec b_1\right)+\vec b_2 = \mathbf{W}\vec x+\vec b, \qquad \mathbf{W}=\mathbf{W}_2\mathbf{W}_1, \quad \vec b=\mathbf{W}_2\vec b_1+\vec b_2, $$
Hence, any number of layers of artificial neurons is strictly equivalent to 1 larger layer, a phenomenon known as depth collapse.
The activation function, which introduces non-linearity, enables the preservation of depth of an ANN.