Swish function
{{Short description|Mathematical activation function in data analysis}}
{{Use dmy dates|date=June 2020|cs1-dates=y}}
The swish function is a family of mathematical function defined as follows:
where can be constant (usually set to 1) or trainable.
The swish family was designed to smoothly interpolate between a linear function and the ReLU function.
When considering positive values, Swish is a particular case of doubly parameterized sigmoid shrinkage function defined in {{Cite book |last1=Atto |first1=Abdourrahmane M. |last2=Pastor |first2=Dominique |last3=Mercier |first3=Gregoire |title=2008 IEEE International Conference on Acoustics, Speech and Signal Processing |chapter=Smooth sigmoid wavelet shrinkage for non-parametric estimation |date=March 2008 |chapter-url=https://ieeexplore.ieee.org/document/4518347 |pages=3265–3268 |doi=10.1109/ICASSP.2008.4518347|isbn=978-1-4244-1483-3 |s2cid=9959057 |url=https://hal.archives-ouvertes.fr/hal-02136546/file/ICASSP_ATTO_2008.pdf }}{{Pg|location=Eq 3}}. Variants of the swish function include Mish.{{cite arXiv |eprint=1908.08681 |class=cs.LG |first=Diganta |last=Misra |title=Mish: A Self Regularized Non-Monotonic Neural Activation Function |date=2019}}
Special values
For β = 0, the function is linear: f(x) = x/2.
For β = 1, the function is the Sigmoid Linear Unit (SiLU).
With β → ∞, the function converges to ReLU.
Thus, the swish family smoothly interpolates between a linear function and the ReLU function.
Since , all instances of swish have the same shape as the default , zoomed by . One usually sets . When is trainable, this constraint can be enforced by , where is trainable.
\operatorname{swish}_1(x) &= \frac{x}{2} \tanh \left(\frac{x}{2}\right) + \frac{x}{2}\\
\operatorname{swish}_1(x) + \operatorname{swish}_{-1}(x) &= x \tanh \left(\frac{x}{2}\right) \\
\operatorname{swish}_1(x) - \operatorname{swish}_{-1}(x) &= x
\end{aligned}
Derivatives
Because , it suffices to calculate its derivatives for the default case.so is odd.so is even.
History
SiLU was first proposed alongside the GELU in 2016, then again proposed in 2017 as the Sigmoid-weighted Linear Unit (SiL) in reinforcement learning. The SiLU/SiL was then again proposed as the SWISH over a year after its initial discovery, originally proposed without the learnable parameter β, so that β implicitly equaled 1. The swish paper was then updated to propose the activation with the learnable parameter β.
In 2017, after performing analysis on ImageNet data, researchers from Google indicated that using this function as an activation function in artificial neural networks improves the performance, compared to ReLU and sigmoid functions. It is believed that one reason for the improvement is that the swish function helps alleviate the vanishing gradient problem during backpropagation.