An artificial neural network (ANN) combines biological principles with advanced statistics to solve problems in domains such as pattern recognition and game-play. ANNs adopt the basic model of neuron analogues connected to each other in a variety of ways.
A neuron with label [math]\displaystyle{ j }[/math] receiving an input [math]\displaystyle{ p_j(t) }[/math] from predecessor neurons consists of the following components:[1]
Often the output function is simply the identity function.
An input neuron has no predecessor but serves as input interface for the whole network. Similarly an output neuron has no successor and thus serves as output interface of the whole network.
The propagation function computes the input [math]\displaystyle{ p_j(t) }[/math] to the neuron [math]\displaystyle{ j }[/math] from the outputs [math]\displaystyle{ o_i(t) }[/math]and typically has the form[1]
A bias term can be added, changing the form to the following:[2]
Neural network models can be viewed as defining a function that takes an input (observation) and produces an output (decision) [math]\displaystyle{ \textstyle f : X \rightarrow Y }[/math] or a distribution over [math]\displaystyle{ \textstyle X }[/math] or both [math]\displaystyle{ \textstyle X }[/math] and [math]\displaystyle{ \textstyle Y }[/math]. Sometimes models are intimately associated with a particular learning rule. A common use of the phrase "ANN model" is really the definition of a class of such functions (where members of the class are obtained by varying parameters, connection weights, or specifics of the architecture such as the number of neurons, number of layers or their connectivity).
Mathematically, a neuron's network function [math]\displaystyle{ \textstyle f(x) }[/math] is defined as a composition of other functions [math]\displaystyle{ \textstyle g_i(x) }[/math], that can further be decomposed into other functions. This can be conveniently represented as a network structure, with arrows depicting the dependencies between functions. A widely used type of composition is the nonlinear weighted sum, where [math]\displaystyle{ \textstyle f (x) = K \left(\sum_i w_i g_i(x)\right) }[/math], where [math]\displaystyle{ \textstyle K }[/math] (commonly referred to as the activation function[3]) is some predefined function, such as the hyperbolic tangent, sigmoid function, softmax function, or rectifier function. The important characteristic of the activation function is that it provides a smooth transition as input values change, i.e. a small change in input produces a small change in output. The following refers to a collection of functions [math]\displaystyle{ \textstyle g_i }[/math] as a vector [math]\displaystyle{ \textstyle g = (g_1, g_2, \ldots, g_n) }[/math].
This figure depicts such a decomposition of [math]\displaystyle{ \textstyle f }[/math], with dependencies between variables indicated by arrows. These can be interpreted in two ways.
The first view is the functional view: the input [math]\displaystyle{ \textstyle x }[/math] is transformed into a 3-dimensional vector [math]\displaystyle{ \textstyle h }[/math], which is then transformed into a 2-dimensional vector [math]\displaystyle{ \textstyle g }[/math], which is finally transformed into [math]\displaystyle{ \textstyle f }[/math]. This view is most commonly encountered in the context of optimization.
The second view is the probabilistic view: the random variable [math]\displaystyle{ \textstyle F = f(G) }[/math] depends upon the random variable [math]\displaystyle{ \textstyle G = g(H) }[/math], which depends upon [math]\displaystyle{ \textstyle H=h(X) }[/math], which depends upon the random variable [math]\displaystyle{ \textstyle X }[/math]. This view is most commonly encountered in the context of graphical models.
The two views are largely equivalent. In either case, for this particular architecture, the components of individual layers are independent of each other (e.g., the components of [math]\displaystyle{ \textstyle g }[/math] are independent of each other given their input [math]\displaystyle{ \textstyle h }[/math]). This naturally enables a degree of parallelism in the implementation.
Networks such as the previous one are commonly called feedforward, because their graph is a directed acyclic graph. Networks with cycles are commonly called recurrent. Such networks are commonly depicted in the manner shown at the top of the figure, where [math]\displaystyle{ \textstyle f }[/math] is shown as dependent upon itself. However, an implied temporal dependence is not shown.
Backpropagation training algorithms fall into three categories:
Let [math]\displaystyle{ N }[/math] be a network with [math]\displaystyle{ e }[/math] connections, [math]\displaystyle{ m }[/math] inputs and [math]\displaystyle{ n }[/math] outputs.
Below, [math]\displaystyle{ x_1,x_2,\dots }[/math] denote vectors in [math]\displaystyle{ \mathbb{R}^m }[/math], [math]\displaystyle{ y_1,y_2,\dots }[/math] vectors in [math]\displaystyle{ \mathbb{R}^n }[/math], and [math]\displaystyle{ w_0, w_1, w_2, \ldots }[/math] vectors in [math]\displaystyle{ \mathbb{R}^e }[/math]. These are called inputs, outputs and weights, respectively.
The network corresponds to a function [math]\displaystyle{ y = f_N(w, x) }[/math] which, given a weight [math]\displaystyle{ w }[/math], maps an input [math]\displaystyle{ x }[/math] to an output [math]\displaystyle{ y }[/math].
In supervised learning, a sequence of training examples [math]\displaystyle{ (x_1,y_1), \dots, (x_p, y_p) }[/math] produces a sequence of weights [math]\displaystyle{ w_0, w_1, \dots, w_p }[/math] starting from some initial weight [math]\displaystyle{ w_0 }[/math], usually chosen at random.
These weights are computed in turn: first compute [math]\displaystyle{ w_i }[/math] using only [math]\displaystyle{ (x_i, y_i, w_{i-1}) }[/math] for [math]\displaystyle{ i = 1, \dots, p }[/math]. The output of the algorithm is then [math]\displaystyle{ w_p }[/math], giving a new function [math]\displaystyle{ x \mapsto f_N(w_p, x) }[/math]. The computation is the same in each step, hence only the case [math]\displaystyle{ i = 1 }[/math] is described.
[math]\displaystyle{ w_1 }[/math] is calculated from [math]\displaystyle{ (x_1, y_1, w_0) }[/math] by considering a variable weight [math]\displaystyle{ w }[/math] and applying gradient descent to the function [math]\displaystyle{ w\mapsto E(f_N(w, x_1), y_1) }[/math] to find a local minimum, starting at [math]\displaystyle{ w = w_0 }[/math].
This makes [math]\displaystyle{ w_1 }[/math] the minimizing weight found by gradient descent.
To implement the algorithm above, explicit formulas are required for the gradient of the function [math]\displaystyle{ w \mapsto E(f_N(w, x), y) }[/math] where the function is [math]\displaystyle{ E(y,y')= |y-y'|^2 }[/math].
The learning algorithm can be divided into two phases: propagation and weight update.
Propagation involves the following steps:
For each weight:
The learning rate is the ratio (percentage) that influences the speed and quality of learning. The greater the ratio, the faster the neuron trains, but the lower the ratio, the more accurate the training. The sign of the gradient of a weight indicates whether the error varies directly with or inversely to the weight. Therefore, the weight must be updated in the opposite direction, "descending" the gradient.
Learning is repeated (on new batches) until the network performs adequately.
Pseudocode for a stochastic gradient descent algorithm for training a three-layer network (one hidden layer):
initialize network weights (often small random values) do for each training example named ex do prediction = neural-net-output(network, ex) // forward pass actual = teacher-output(ex) compute error (prediction - actual) at the output units compute [math]\displaystyle{ \Delta w_h }[/math] for all weights from hidden layer to output layer // backward pass compute [math]\displaystyle{ \Delta w_i }[/math] for all weights from input layer to hidden layer // backward pass continued update network weights // input layer not modified by error estimate until error rate becomes acceptably low return the network
The lines labeled "backward pass" can be implemented using the backpropagation algorithm, which calculates the gradient of the error of the network regarding the network's modifiable weights.[5]
Original source: https://en.wikipedia.org/wiki/Mathematics of artificial neural networks.
Read more |