Jump to content

User:Tycho01/Activation function

From Wikipedia, the free encyclopedia
Logistic activation function

In computational networks, the activation function of a node defines the output of that node given an input or set of inputs. A standard computer chip circuit can be seen as a digital network of activation functions that can be "ON" (1) or "OFF" (0), depending on input. This is similar to the behavior of the linear perceptron in neural networks. However, only nonlinear activation functions allow such networks to compute nontrivial problems using only a small number of nodes. In artificial neural networks this function is also called the transfer function.

Functions

[edit]

In biologically inspired neural networks, the activation function is usually an abstraction representing the rate of action potential firing in the cell[according to whom?]. In its simplest form, this function is binary—that is, either the neuron is firing or not. The function looks like , where is the Heaviside step function. In this case many neurons must be used in computation beyond linear separation of categories.

A line of positive slope may be used to reflect the increase in firing rate that occurs as input current increases. Such a function would be of the form , where is the slope. This activation function is linear, and therefore has the same problems as the binary function. In addition, networks constructed using this model have unstable convergence because neuron inputs along favored paths tend to increase without bound, as this function is not normalizable.

All problems mentioned above can be handled by using a normalizable sigmoid activation function. One realistic model stays at zero until input current is received, at which point the firing frequency increases quickly at first, but gradually approaches an asymptote at 100% firing rate. Mathematically, this looks like , where the hyperbolic tangent function can be replaced by any sigmoid function. This behavior is realistically reflected in the neuron, as neurons cannot physically fire faster than a certain rate. This model runs into problems, however, in computational networks as it is not differentiable, a requirement to calculate backpropagation.

The final model, then, that is used in multilayer perceptrons is a sigmoidal activation function in the form of a hyperbolic tangent. Two forms of this function are commonly used: whose range is normalized from -1 to 1, and is vertically translated to normalize from 0 to 1. The latter model is often considered more biologically realistic, but it runs into theoretical and experimental difficulties with certain types of computational problems.

Alternative structures

[edit]

A special class of activation functions known as radial basis functions (RBFs) are used in RBF networks, which are extremely efficient as universal function approximators. These activation functions can take many forms, but they are usually found as one of three functions:

  • Gaussian:
  • Multiquadratics:
  • Inverse multiquadratics:

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

Support vector machines (SVMs) can effectively utilize a class of activation functions that includes both sigmoids and RBFs. In this case, the input is transformed to reflect a decision boundary hyperplane based on a few training inputs called support vectors . The activation function for the hidden layer of these machines is referred to as the inner product kernel, . The support vectors are represented as the centers in RBFs with the kernel equal to the activation function, but they take a unique form in the perceptron as

,

where and must satisfy certain conditions for convergence. These machines can also accept arbitrary-order polynomial activation functions where

.[1]

Activation function having types:

  • Identity function
  • Binary step function
  • Bipolar step function
  • Sigmoidal function
    • Binary sigmoidal function
    • Bipolar sigmoidal function
  • Ramp function

Comparison of activation functions

[edit]

Some desirable properties in an activation function include:

  • Nonlinear – When the activation function is non-linear, then a two-layer neural network can be proven to be a universal function approximator.[2] 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 (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.[3]
  • 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]
  • Monotonic – When the activation function is monotonic, the error surface associated with a single-layer model is guaranteed to be convex.[4]
  • Smooth Functions with a Monotonic derivative – These have been shown to generalize better in some cases. The argument for these properties suggests that such activation functions are more consistent with Occam's razor.[5]
  • Approximates identity near the origin – When activation functions have this property, the neural network will learn efficiently when its weights are initialized with small random values. When the activation function does not approximate identity near the origin, special care must be used when initializing the weights.[6] In the table below, activation functions where and and is continuous at 0 are indicated as having this property.
  • Scale equivariant, a nice property to have for images
  • Steepness, expressed as absolute/squared difference from the identity function integrated over x from -1 to 1.
  • Parallelizable: can be calculated element-wise to facilitate fast parallel evaluation
  • Numeric stability to prevent exploding/vanishing gradients
  • Meaningful gradient
  • Symmetry about the origin: otherwise more prone to saturation of the later layers, making training more difficult.

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 Equation Derivative (with respect to x) Range Order of continuity Monotonic Derivative Monotonic Approximates identity near the origin Non-linear (can stack layers) Continuously differentiable Range bound (no blowing up) Scale equivariance Steepness (abs) Steepness (sqrd) Notes
Identity Yes Yes Yes No Yes No Depends 0 0 gradient has unrelated to input breaking back-prop, linear so no point in 2+ layers, penalizes for confidently getting things right
Binary step Yes No No Yes No Yes No 1 0.666667 learning wiggly, too simple for multiple activated input neurons (can't pick which is activated 'most')
Logistic (a.k.a. Sigmoid or Soft step) [1] Yes No No Yes Yes Yes No 1.0912 0.886779 steep so tends to yield values near 0 or 1, good for classification. output constrained too :) unlike identity. small gradients toward ends (vanishing gradients problem) -- learning almost stops.
TanH Yes No Yes Yes Yes Yes No 0.13244 0.0186754 activations ~0 mean :)
ArcTan Yes No Yes Yes Yes Yes No 0.1224 0.0156364
Softsign [7][8] Yes No Yes Yes Yes Yes No 0.38629 0.1215
Inverse square root unit (ISRU)[9] Yes No Yes Yes Yes Yes No 0.17157 0.0302
Rectified linear unit (ReLU)[10] Yes Yes No Yes No No Depends 0.5 0.3333333 more expressive than logistic, faster since 0s (sparse activation) save some calculations. 0 gradient for negative x (dying ReLu problem), fixed in e.g. leaky ReLu.
Leaky rectified linear unit (Leaky ReLU)[11] Yes Yes No Yes No No No 0.495 0.3267
Parameteric rectified linear unit (PReLU)[12] Yes iff Yes Yes iff Yes No No No abs(1-a)/2 1/3*(a-1)^2
Randomized leaky rectified linear unit (RReLU)[13] [2] Yes Yes No Yes No No No abs(1-a)/2 1/3*(a-1)^2
Exponential linear unit (ELU)[14] Yes iff Yes iff Yes iff Yes No No No ? -(1-4*e+e^2)/(2*e^2) + (e-4)*a/e + 1/3
Scaled exponential linear unit (SELU)[15]

with and

Yes No No Yes No No No 0.172117 0.0247699
S-shaped rectified linear activation unit (SReLU)[16]
are parameters.
No No No Yes No No No ? ?
Inverse square root linear unit (ISRLU)[9] Yes Yes Yes Yes No No No ? ?
Adaptive piecewise linear (APL) [17] [3] No No No Yes Yes No No ? ?
SoftPlus[18] Yes Yes No Yes Yes No No 1.4676 1.24624
Bent identity Yes Yes Yes Yes Yes No No 0.147794 0.0188731
Sigmoid-weighted linear unit (SiLU)[19] (a.k.a. Swish[20]) [4] [5] No No No Yes Yes No No 0.5 0.188987
SoftExponential [21] Yes Yes Yes iff Yes No No No ? ?
Sinusoid[22] No No Yes Yes Yes Yes No 0.080605 0.0073
Sinc No No No Yes No Yes No 1.91163 2.46135
Gaussian No No No Yes Yes Yes No 1.7155 1.86295
^ Here, H is the Heaviside step function.
^ α is a stochastic variable sampled from a uniform distribution at training time and fixed to the expectation value of the distribution at test time.
^ ^ ^ Here, is the logistic function.

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

Name Equation Derivatives Range Order of continuity Notes
Softmax    for i = 1, …, J [6] probability distribution group (multi-class classification)
Maxout[23]

^ Here, δ is the Kronecker delta.

See also

[edit]

References

[edit]
  1. ^ Haykin, Simon S. (1999). Neural Networks: A Comprehensive Foundation. Prentice Hall. ISBN 978-0-13-273350-2.
  2. ^ Cybenko, G.V. (2006). "Approximation by Superpositions of a Sigmoidal function". In van Schuppen, Jan H. (ed.). Mathematics of Control, Signals, and Systems. Springer International. pp. 303–314.
  3. ^ 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.
  4. ^ Wu, Huaiqin (2009). "Global stability analysis of a general class of discontinuous neural networks with linear growth activation functions". Information Sciences. 179 (19): 3432–3441. doi:10.1016/j.ins.2009.06.006.
  5. ^ Gashler, Michael S.; Ashmore, Stephen C. (2014-05-09). "Training Deep Fourier Neural Networks To Fit Time-Series Data". arXiv:1405.2262 [cs.NE].
  6. ^ Sussillo, David; Abbott, L. F. (2014-12-19). "Random Walk Initialization for Training Very Deep Feedforward Networks". arXiv:1412.6558 [cs.NE].
  7. ^ Bergstra, James; Desjardins, Guillaume; Lamblin, Pascal; Bengio, Yoshua (2009). "Quadratic polynomials learn better image features". Technical Report 1337". Département d’Informatique et de Recherche Opérationnelle, Université de Montréal.
  8. ^ Glorot, Xavier; Bengio, Yoshua (2010), "Understanding the difficulty of training deep feedforward neural networks" (PDF), International Conference on Artificial Intelligence and Statistics (AISTATS'10), Society for Artificial Intelligence and Statistics
  9. ^ a b Carlile, Brad; Delamarter, Guy; Kinney, Paul; Marti, Akiko; Whitney, Brian (2017-11-09). "Improving Deep Learning by Inverse Square Root Linear Units (ISRLUs)". arXiv:1710.09967 [cs.LG].
  10. ^ 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
  11. ^ Maas, Andrew L.; Hannun, Awni Y.; Ng, Andrew Y. (June 2013). "Rectifier nonlinearities improve neural network acoustic models" (PDF). Proc. ICML. 30 (1). S2CID 16489696. Retrieved 2 January 2017.
  12. ^ 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].
  13. ^ Xu, Bing; Wang, Naiyan; Chen, Tianqi; Li, Mu (2015-05-04). "Empirical Evaluation of Rectified Activations in Convolutional Network". arXiv:1505.00853 [cs.LG].
  14. ^ 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].
  15. ^ Klambauer, Günter; Unterthiner, Thomas; Mayr, Andreas; Hochreiter, Sepp (2017-06-08). "Self-Normalizing Neural Networks". arXiv:1706.02515 [cs.LG].
  16. ^ Jin, Xiaojie; Xu, Chunyan; Feng, Jiashi; Wei, Yunchao; Xiong, Junjun; Yan, Shuicheng (2015-12-22). "Deep Learning with S-shaped Rectified Linear Activation Units". arXiv:1512.07030 [cs.CV].
  17. ^ Forest Agostinelli; Matthew Hoffman; Peter Sadowski; Pierre Baldi (21 Dec 2014). "Learning Activation Functions to Improve Deep Neural Networks". arXiv:1412.6830 [cs.NE].
  18. ^ Glorot, Xavier; Bordes, Antoine; Bengio, Yoshua (2011). "Deep sparse rectifier neural networks" (PDF). International Conference on Artificial Intelligence and Statistics.
  19. ^ Sigmoid-Weighted Linear Units for Neural Network Function Approximation in Reinforcement Learning
  20. ^ Searching for Activation Functions
  21. ^ Godfrey, Luke B.; Gashler, Michael S. (2016-02-03). "A continuum among logarithmic, linear, and exponential functions, and its potential to improve generalization in neural networks". 7th International Joint Conference on Knowledge Discovery, Knowledge Engineering and Knowledge Management: KDIR. 1602: 481–486. arXiv:1602.01321. Bibcode:2016arXiv160201321G.
  22. ^ Gashler, Michael S.; Ashmore, Stephen C. (2014-05-09). "Training Deep Fourier Neural Networks To Fit Time-Series Data". arXiv:1405.2262 [cs.NE].
  23. ^ Goodfellow, Ian J.; Warde-Farley, David; Mirza, Mehdi; Courville, Aaron; Bengio, Yoshua (2013-02-18). "Maxout Networks". JMLR WCP. 28 (3): 1319–1327. arXiv:1302.4389. Bibcode:2013arXiv1302.4389G.