User:Tycho01/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
In biologically inspired neural networks, the activation function is usually an abstraction representing the rate of action potential firing in the cell. In its simplest form, this function is binary—that is, either the neuron is firing or not. The function looks like $$\phi(v_i)=U(v_i)$$, where $$U$$ 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 $$\phi(v_i)=\mu v_i$$, where $$\mu$$ 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 $$\phi(v_i)=U(v_i)\tanh(v_i)$$, 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: $$\phi(v_i)=\tanh(v_i)$$ whose range is normalized from -1 to 1, and $$\phi(v_i) = (1+\exp(-v_i))^{-1}$$ 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
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: where $$c_i$$ is the vector representing the function center and $$a$$ and $$\sigma$$ are parameters affecting the spread of the radius.
 * Gaussian: $$\,\phi(v_i)=\exp\left(-\frac{\|v_i-c_i\|^2}{2\sigma^2}\right)$$
 * Multiquadratics: $$\,\phi(v_i)=\sqrt{\|v_i-c_i\|^2 + a^2}$$
 * Inverse multiquadratics: $$\,\phi(v_i)=(\|v_i-c_i\|^2 + a^2)^{-1/2}$$

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 $$x$$. The activation function for the hidden layer of these machines is referred to as the inner product kernel, $$K(v_i,x)=\phi(v_i)$$. 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
 * $$\,\phi(v_i)=\tanh\left(\beta_1 + \beta_0 \sum_j v_{i,j} x_j \right)$$,

where $$\beta_0$$ and $$\beta_1$$ must satisfy certain conditions for convergence. These machines can also accept arbitrary-order polynomial activation functions where
 * $$\,\phi(v_i)=\left(1+\sum_j v_{i,j} x_j \right)^p$$.

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
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. 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.
 * 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.
 * Monotonic – When the activation function is monotonic, the error surface associated with a single-layer model is guaranteed to be convex.
 * 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.
 * 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. In the table below, activation functions where $$f(0)=0$$ and $$f'(0)=1$$ and $$f'$$ 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:
 * Here, $H$ is the Heaviside step function.
 * $&alpha;$ 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, $$\sigma$$ 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:

Here, $i$ is the Kronecker delta.