Mathematics of artificial neural networks

Main article: Artificial neural network

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.

## Contents

* 1 Structure
* 1.1 Neuron
* 1.2 Propagation function
* 1.3 Bias
* 2 Neural networks as functions
* 3 Backpropagation
* 3.1 Algorithm
* 4 Learning pseudocode
* 4.1 Propagation
* 4.2 Weight update
* 4.3 Pseudocode
* 5 References

## Structure

### Neuron

A neuron with label j receiving an input pj(t) from predecessor neurons consists of the following components:[1]

* an activation aj(t), the neuron's state, depending on a discrete time parameter,
* an optional threshold θj, which stays fixed unless changed by learning,
* an activation function f that computes the new activation at a given time t+1 from aj(t), θj and the net input pj(t) giving rise to the relation

aj(t+1)=f(aj(t),pj(t),θj),

* and an output function fout computing the output from the activation

oj(t)=fout(aj(t)).

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.

### Propagation function

The propagation function computes the input pj(t) to the neuron j from the outputs oi(t)and typically has the form[1]

pj(t)=∑ioi(t)wij.

### Bias

A bias term can be added, changing the form to the following:[2]

pj(t)=∑ioi(t)wij+w0j, where w0j is a bias.

## Neural networks as functions

Neural network models can be viewed as defining a function that takes an input (observation) and produces an output (decision) f:X->Y or a distribution over X or both X and Y. 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 f(x) is defined as a composition of other functions gi(x), 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 f(x)=K(∑iwigi(x)), where K (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 gi as a vector g=(g1,g2,…,gn).

ANN dependency graph

This figure depicts such a decomposition of f, with dependencies between variables indicated by arrows. These can be interpreted in two ways.

The first view is the functional view: the input x is transformed into a 3-dimensional vector h, which is then transformed into a 2-dimensional vector g, which is finally transformed into f. This view is most commonly encountered in the context of optimization.

The second view is the probabilistic view: the random variable F=f(G) depends upon the random variable G=g(H), which depends upon H=h(X), which depends upon the random variable X. 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 g are independent of each other given their input h). This naturally enables a degree of parallelism in the implementation.

Two separate depictions of the recurrent ANN dependency graph

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 f is shown as dependent upon itself. However, an implied temporal dependence is not shown.

## Backpropagation

Backpropagation training algorithms fall into three categories:

* steepest descent (with variable learning rate and momentum, resilient backpropagation);
* quasi-Newton (Broyden–Fletcher–Goldfarb–Shanno, one step secant);
* Levenberg–Marquardt and conjugate gradient (Fletcher–Reeves update, Polak–Ribiére update, Powell–Beale restart, scaled conjugate gradient).[4]

### Algorithm

Let N be a network with e connections, m inputs and n outputs.

Below, x1,x2,… denote vectors in ℝm, y1,y2,… vectors in ℝn, and w0,w1,w2,… vectors in ℝe. These are called inputs, outputs and weights, respectively.

The network corresponds to a function y=fN(w,x) which, given a weight w, maps an input x to an output y.

In supervised learning, a sequence of training examples (x1,y1),…,(xp,yp) produces a sequence of weights w0,w1,…,wp starting from some initial weight w0, usually chosen at random.

These weights are computed in turn: first compute wi using only (xi,yi,wi−1) for i=1,…,p. The output of the algorithm is then wp, giving a new function x↦fN(wp,x). The computation is the same in each step, hence only the case i=1 is described.

w1 is calculated from (x1,y1,w0) by considering a variable weight w and applying gradient descent to the function w↦E(fN(w,x1),y1) to find a local minimum, starting at w=w0.

This makes w1 the minimizing weight found by gradient descent.

## Learning pseudocode

To implement the algorithm above, explicit formulas are required for the gradient of the function w↦E(fN(w,x),y) where the function is E(y,y′)=|y−y′|2.

The learning algorithm can be divided into two phases: propagation and weight update.

### Propagation

Propagation involves the following steps:

* Propagation forward through the network to generate the output value(s)
* Calculation of the cost (error term)
* Propagation of the output activations back through the network using the training pattern target to generate the deltas (the difference between the targeted and actual output values) of all output and hidden neurons.

### Weight update

For each weight:

* Multiply the weight's output delta and input activation to find the gradient of the weight.
* Subtract the ratio (percentage) of the weight's gradient from the 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

Pseudocode for a stochastic gradient descent algorithm for training a three-layer network (one hidden layer):

initialize network weights (often small random values)

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 Δwh for all weights from hidden layer to output layer  // backward pass
compute Δwi 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]

## References

1. ↑ 1.0 1.1 Zell, Andreas (2003). "chapter 5.2" (in German). Simulation neuronaler Netze (1st ed.). Addison-Wesley. ISBN 978-3-89319-554-1. OCLC 249017987.
2. ↑ DAWSON, CHRISTIAN W (1998). "An artificial neural network approach to rainfall-runoff modelling". Hydrological Sciences Journal 43 (1): 47–66. doi:10.1080/02626669809492102.
3. ↑ "The Machine Learning Dictionary". http://www.cse.unsw.edu.au/~billw/mldict.html#activnfn.
4. ↑ M. Forouzanfar; H. R. Dajani; V. Z. Groza; M. Bolic; S. Rajan (July 2010). "Comparison of Feed-Forward Neural Network Training Algorithms for Oscillometric Blood Pressure Estimation". 4th Int. Workshop Soft Computing Applications. Arad, Romania: IEEE. https://www.researchgate.net/publication/224173336.
5. ↑ Werbos, Paul J. (1994). The Roots of Backpropagation. From Ordered Derivatives to Neural Networks and Political Forecasting. New York, NY: John Wiley & Sons, Inc.

0.00

(0 votes)

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Mathematics_of_artificial_neural_networks&oldid=3907225"