Sobol sequence: Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>Ruby Murray
Filling in 3 references using Reflinks
en>BG19bot
m →‎Implementation and availability of Sobol sequences: WP:CHECKWIKI error fix for #61. Punctuation goes before References. Do general fixes if a problem exists. - using AWB (10511)
 
Line 1: Line 1:
{{About|the computer algorithm|the biological process|Neural backpropagation}}
Hello. Let me introduce the author. Her title is Refugia Shryock. Hiring is her day job now  over the counter std test at home std [http://www.identigene.com/std-testing/blog/2010/12/identigene-std-test-kit-now-available-at-walmart-com/ testing] but she's always wanted her personal company. One of the extremely best things in the world for me is to do aerobics at home std test and I've been performing it for quite a while. Puerto Rico is where he's always been living but she requirements to move because of her family.<br><br>Feel free to surf to my webpage - at home std test ([http://www.mycamspy.com/blog/29947 find more information])
{{multiple issues|
{{Expand German|Backpropagation|date=March 2009}}
{{Expand Spanish|Backpropagation|date=April 2013}}
{{technical|date=September 2012}}
}}
'''Backpropagation''', an abbreviation for "backward propagation of errors", is a common method of training [[artificial neural networks]]. From a desired output, the network learns from many inputs, similar to the way a child learns to identify a dog from examples of dogs.
 
It is a [[supervised learning]] method, and is a generalization of the [[delta rule]]. It requires a dataset of the desired output for many inputs, making up the training set. It is most useful for feed-forward networks (networks that have no feedback, or simply, that have no connections that loop). Backpropagation requires that the [[activation function]] used by the [[artificial neuron]]s (or "nodes") be [[differentiable]].
 
This article provides details on how backpropagation works. For programmers attempting to implement a system, the tutorials linked in the External Links may be more useful.
 
==Motivation==
 
The goal of any [[supervised learning]] algorithm is to find a function that best maps a set of inputs to its correct output. An example would be a simple [[Classification (machine learning)|classification]] task, where the input is an image of an animal, and the correct output would be the name of the animal. Some input and output patterns can be easily learned by single-layer neural networks (i.e. [[perceptrons]]). However, these single-layer perceptrons cannot learn some relatively simple patterns, such as those that are not [[linearly separable]]. For example, a human may classify an image of an animal by recognizing certain features such as the number of limbs, the texture of the skin (whether it is furry, feathered, scaled, etc.), the size of the animal, and the list goes on. A single-layer neural network however, must learn a function that outputs a label solely using the intensity of the pixels in the image. There is no way for it to learn any abstract features of the input since it is limited to having only one layer. A multi-layered network overcomes this limitation as it can create internal representations and learn different features in each layer.<ref name=Rumelhart1986 /> The first layer may be responsible for learning the orientations of lines using the inputs from the individual pixels in the image. The second layer may combine the features learned in the first layer and learn to identify simple shapes such as circles. Each higher layer learns more and more abstract features such as those mentioned above that can be used to classify the image. Each layer finds patterns in the layer below it and it is this ability to create internal representations that are independent of outside input that gives multi-layered networks its power.
The goal and motivation for developing the backpropagation algorithm is to find a way to train multi-layered neural networks such that it can learn the appropriate internal representations to allow it to learn any arbitrary mapping of input to output.<ref name=Rumelhart1986 />
 
==Summary==
 
The backpropagation learning algorithm can be divided into two phases: propagation and weight update.
 
=== Phase 1: Propagation ===
 
Each propagation involves the following steps:
 
# Forward propagation of a training pattern's input through the neural network in order to generate the propagation's output activations.
# Backward propagation of the propagation's output activations through the neural network using the training pattern target in order to generate the deltas of all output and hidden neurons.
 
=== Phase 2: Weight update ===
 
For each weight-synapse follow the following steps:
# Multiply its output delta and input activation to get the gradient of the weight.
# Subtract a ratio (percentage) of the gradient from the weight.
This ratio (percentage) influences the speed and quality of learning; it is called the ''learning rate''. The greater the ratio, the faster the neuron trains; the lower the ratio, the more accurate the training is. The sign of the gradient of a weight indicates where the error is increasing, this is why the weight must be updated in the opposite direction.
 
Repeat phase 1 and 2 until the performance of the network is satisfactory.
 
==Algorithm==
 
Algorithm for a 3-layer network (only one hidden layer):
  initialize network weights (often small random values)
  '''do'''
      '''forEach''' training example ex
        prediction = <u>neural-net-output</u>(network, ex)  ''// forward pass''
        actual = <u>teacher-output</u>(ex)
        compute error (prediction - actual) at the output units
        compute <math>\Delta w_h</math> for all weights from hidden layer to output layer  ''// backward pass''
        compute <math>\Delta w_i</math> for all weights from input layer to hidden layer  ''// backward pass continued''
        update network weights
  '''until''' all examples classified correctly or another stopping criterion satisfied
  '''return''' the network
 
As the [[algorithm]]'s name implies, the errors propagate backwards from the output nodes to the input nodes. Technically speaking, backpropagation calculates the gradient of the error of the network regarding the network's modifiable weights.<ref>Paul J. Werbos (1994). The Roots of Backpropagation. From Ordered Derivatives to Neural Networks and Political Forecasting. New York, NY: John Wiley & Sons, Inc.</ref> This gradient is almost always used in a simple [[stochastic gradient descent]] algorithm to find weights that minimize the error.  Often the term "backpropagation" is used in a more general sense, to refer to the entire procedure encompassing both the calculation of the gradient and its use in stochastic gradient descent. Backpropagation usually allows quick convergence on satisfactory [[Maxima and minima|local minima]] for error in the kind of networks to which it is suited.
 
Backpropagation networks are necessarily [[multilayer perceptron]]s (usually with one input, one hidden, and one output layer). In order for the hidden layer to serve any useful function, multilayer networks must have non-linear activation functions for the multiple layers: a multilayer network using only linear activation functions is equivalent to some single layer, linear network. Non-linear activation functions that are commonly used include the [[logistic function]], the [[softmax activation function|softmax function]], and the [[gaussian function]].
 
The backpropagation algorithm for calculating a gradient has been rediscovered a number of times, and is a special case of a more general technique called [[automatic differentiation]] in the reverse accumulation mode.
 
It is also closely related to the [[Gauss–Newton algorithm]], and is also part of continuing research in [[neural backpropagation]].
 
==Intuition==
 
=== Learning as an optimization problem ===
Before showing the mathematical derivation of the backpropagation algorithm, it helps to develop some intuitions about the relationship between the actual output of a neuron and the correct output for a particular training case. Consider a simple neural network with two input units, one output unit and no hidden units. Each neuron uses a [[Artificial_neuron#Linear_combination|linear output]]<ref group="note">One may notice that multi-layer neural networks use non-linear activation functions, so an example with linear neurons seems obscure. However, even though the error surface of multi-layer networks are much more complicated, locally they can be approximated by a paraboloid. Therefore, linear neurons are used for simplicity and easier understanding.</ref> that is the weighted sum of its input. [[File:A simple neural network with two input units and one output unit.png|thumb|250px|A simple neural network with two input units and one output unit]]
 
Initially, before training, the weights will be set randomly. Then the neuron learns from [[Training set|training examples]], which in this case consists of a set of tuples (<math>x_{1}</math>, <math>x_{2}</math>, <math>t</math>) where <math>x_{1}</math> and <math>x_{2}</math> are the inputs to the network and <math>t</math> is the correct output (the output the network should eventually produce given the identical inputs). The network given <math>x_{1}</math> and <math>x_{2}</math> will compute an output <math>y</math> which very likely differs from <math>t</math> (since the weights are initially random). A common method for measuring the discrepancy between the expected output <math>t</math> and the actual output <math>y</math> is using the squared error measure:
:<math>E=(t-y)^2 \,</math>,
where <math>E</math> is the discrepancy or error.
 
As an example, consider the network on a single training case: (1, 1, 0), thus the input <math>x_{1}</math> and <math>x_{2}</math> are 1 and 1 respectively and the correct output, <math>t</math> is 0. Now if the actual output <math>y</math> is plotted on the x-axis against the error <math>E</math> on the y-axis, the result is a parabola. The [[Maxima and minima|minimum]] of the [[parabola]] corresponds to the output <math>y</math> which minimizes the error <math>E</math>. For a single training case, the minimum also touches the x-axis, which means the error will be zero and the network can produce an output y that exactly matches the expected output <math>t</math>. Therefore, the problem of mapping inputs to outputs can be reduced to an [[optimization problem]] of finding a function that will produce the minimal error. [[File:Error surface of a linear neuron for a single training case.png|right|thumb|250px|Error surface of a linear neuron for a single training case.]]
 
However, the output of a neuron depends on the weighted sum of all its inputs:
:<math>y=x_1w_1 + x_2w_2</math>,
where <math>w_1</math> and <math>w_2</math> are the weights on the connection from the input units to the output unit. Therefore, the error also depends on the incoming weights to the neuron, which is ultimately what needs to be changed in the network to enable learning. If each weight is plotted on a separate horizontal axis and the error on the vertical axis, the result is a [[Paraboloid|parabolic bowl]] (If a neuron has k weights, then the [[Dimension (mathematics and physics)|dimension]] of the error surface would be k+1, thus a k+1 dimensional equivalent of the 2D parabola).
[[File:Error surface of a linear neuron with two input weights.png|thumb|250px|Error surface of a linear neuron with two input weights]]
 
The backpropagation algorithm aims to find the set of weights that minimizes the error. There are several methods for finding the minima of a parabola or any function in any dimension. One way is analytically by solving [[System of polynomial equations|systems of equations]], however this relies on the network being a [[linear system]], and the goal is to be able to also train multi-layer, [[Nonlinear system|non-linear]] networks (since a multi-layered linear network is equivalent to a single-layer network). The method used in backpropagation is [[gradient descent]].
 
=== An analogy for understanding gradient descent ===
{{Further|Gradient descent}}
The basic intuition behind [[gradient descent]] can be illustrated by a hypothetical scenario. A person is stuck in the mountains is trying to get down (i.e. trying to find the minima). There is heavy fog such that visibility is extremely low. Therefore, the path down the mountain is not visible, so he must use local information to find the minima. He can use the method of gradient descent, which involves looking at the steepness of the hill at his current position, then proceeding in the direction with the most negative steepness (i.e. downhill). If he was trying to find the top of the mountain (i.e. the maxima), then he would proceed in the direction with most positive steepness (i.e. uphill). Using this method, he would eventually find his way down the mountain. However, assume also that the steepness of the hill is not immediately obvious with simple observation, but rather it requires a sophisticated instrument to measure, which the person happens to have at the moment. It takes quite some time to measure the steepness of the hill with the instrument, thus he should minimize his use of the instrument if he wanted to get down the mountain before sunset. The difficulty then is choosing the frequency at which he should measure the steepness of the hill so not to go off track.
 
In this analogy, the person represents the backpropagation algorithm, and the path down the mountain represents the set of weights that will minimize the error. The steepness of the hill represents the [[slope]] of the error surface at that point. The direction he must travel in corresponds to the [[gradient]] of the error surface at that point. The instrument used to measure steepness is [[Differentiation (mathematics)|differentiation]] (the slope of the error surface can be calculated by taking the [[derivative]] of the squared error function at that point). The distance he travels in between measurements (which is also proportional to the frequency as which he takes measurement) is the learning rate of the algorithm. See the [[backpropagation#Limitations|limitation section]] for a discussion of the limitations of this type of "hill climbing" algorithm.
 
==Derivation==
{{See also|Delta Rule}}
Since backpropagation uses the gradient descent method, one needs to calculate the derivative of the squared error function with respect to the weights of the network. The squared error function is:
 
{| cellpadding="5"
|
| <math>E = \tfrac{1}{2}(t - y)^2</math>,
|-
|
| <math>E</math> = the squared error
|-
|
| <math>t</math> = target output
|-
|
| <math>y</math> = actual output of the output neuron<ref group="note">There can be multiple output neurons, however backpropagation treats each in isolation when calculating the gradient, therefore, in the rest of the derivation, only one output neuron is considered.</ref>
|}
 
(The factor of <math>\frac{1}{2}</math> is included to cancel the exponent when differentiating.) Therefore the error, <math>E</math>, depends on the output <math> y </math>. However, the output <math>y</math> depends on the weighted sum of all its input:
{| cellpadding="5"
|
| <math>y = \sum_{i=1}^{n}w_ix_i</math>
|-
|
| <math>n</math> = the number of input units to the neuron
|-
|
| <math>w_i</math> = the i<sup>th</sup> weight
|-
|
| <math>x_i</math> = the i<sup>th</sup> input value to the neuron
|}
 
The above formula only holds true for a neuron with a linear activation function (that is the output is solely the weighted sum of the input). In general, a [[non-linear]], [[differentiable]] [[activation function]], <math>\varphi</math>, is used. Thus, more correctly:
{| cellpadding="5"
|
| <math>y = \varphi(\mathrm{net})</math>
|-
|
| <math>\mathrm{net} = \sum_{i=1}^{n}w_ix_i</math>
|}
This lays the groundwork for calculating the [[partial derivative]] of the error with respect to a weight <math>w_i</math> using the [[chain rule]]:
{| cellpadding="5"
|
| <math>\frac{\partial E}{\partial w_i} = \frac{dE}{dy} \frac{dy}{d\mathrm{net}} \frac{\partial \mathrm{net}}{\partial w_i}</math>
|-
|
| <math>\frac{\partial E}{\partial w_i}</math> = How the error changes when the weights are changed
|-
|
| <math>\frac{dE}{dy}</math> = How the error changes when the output is changed
|-
|
| <math>\frac{dy}{d\mathrm{net}}</math> = How the output changes when the weighted sum changes
|-
|
| <math>\frac{\partial \mathrm{net}} {\partial w_i}</math> = How the weighted sum changes as the weights change
|}
Since the weighted sum <math>\mathrm{net}</math> is just the sum over all products <math>w_i</math> <math>x_i</math>, therefore the partial derivative of the sum with respect to a weight <math>w_i</math> is the just the corresponding input <math>x_i</math>. Similarly, the partial derivative of the sum with respect to an input value <math>x_i</math> is just the weight <math>w_i</math>:
{| cellpadding="5"
|
| <math>\frac{\partial \mathrm{net}}{\partial w_i} = x_i</math>
|-
|
| <math>\frac{\partial \mathrm{net}}{\partial x_i} = w_i</math>
|}
The derivative of the output <math>y</math> with respect to the weighted sum <math>\mathrm{net}</math> is simply the derivative of the activation function <math>\varphi</math>:
: <math>\frac{dy}{d\mathrm{net}} = \frac{d}{d\mathrm{net}}\varphi </math>
This is the reason why backpropagation requires the activation function to be [[differentiable]]. A commonly used activation function is the [[logistic function]]:
: <math> y = \frac{1}{1+e^{-z}}</math>
which has a nice derivative of:
: <math> \frac {dy}{dz} = y(1-y) </math>
For example purposes, assume the network uses a logistic activation function, in which case the derivative of the output <math>y</math> with respect to the weighted sum <math>\mathrm{net}</math> is the same as the derivative of the logistic function:
: <math> \frac {dy}{d\mathrm{net}} = y(1-y) </math>
Finally, the derivative of the error <math>E</math> with respect to the output <math>y</math> is:
{| cellpadding="5"
|
| <math>\frac{dE}{dy} = \frac {d}{dy} \frac{1}{2}(t - y)^2 </math>
|-
|
| <math>\frac{dE}{dy} = y - t </math>
|}
Putting it all together:
{| cellpadding="5"
|
| <math>\frac{\partial E}{\partial w_i} = \frac{dE}{dy} \frac{dy}{d\mathrm{net}} \frac{\partial \mathrm{net}}{\partial w_i}</math>
|-
|
| <math>\frac{\partial E}{\partial w_i} = (y - t) y (1 - y) x_i</math>
|}
If one were to use a different activation function, the only difference would be the <math>y (1 - y)</math> term will be replaced by the derivative of the newly chosen activation function.
 
To update the weight <math>w_i</math> using gradient descent, one must choose a learning rate, <math>\alpha</math>. The change in weight after learning then would be the product of the learning rate and the gradient:
{| cellpadding="5"
|
| <math> \Delta w_i = - \alpha \frac{\partial E}{\partial w_i} </math>
|-
|
| <math> \Delta w_i = \alpha (t - y) \varphi' x_i </math>
|}
For a linear neuron, the derivative of the activation function <math> \varphi </math> is 1, which yields:
: <math> \Delta w_i = \alpha (t - y) x_i </math>
This is exactly the delta rule for [[Perceptron#Learning_algorithm|perceptron learning]], which is why the backpropagation algorithm is a generalization of the delta rule. In backpropagation and perceptron learning, when the output <math>y</math> matches the desired output <math>t</math>, the change in weight <math> \Delta w_i </math> would be zero, which is exactly what is desired.
 
== Modes of learning ==
 
There are three modes of learning to choose from: [[online machine learning | on-line]], batch and [[stochastic gradient descent | stochastic]]. In on-line and stochastic learning, each propagation is followed immediately by a weight update. In batch learning, many propagations occur before updating the weights. Batch learning requires more memory capacity, but on-line and stochastic learning require more updates. On-line learning is used for dynamic environments that provide a continuous stream of new patterns. Stochastic learning and batch learning both make use of a training set of static patterns. Stochastic goes through the data set in a random order in order to reduce its chances of getting stuck in local minima. Stochastic learning is also much faster than batch learning since weights are updated immediately after each propagation. Yet batch learning will yield a much more stable descent to a local minima since each update is performed based on all patterns.
 
==Multithreaded backpropagation==
 
Backpropagation is an iterative process that can often take a great deal of time to complete. When [[Multi-core processor|multicore]] computers are used [[multithreaded]] techniques can greatly decrease the amount of time that backpropagation takes to converge.  If batching is being used, it is relatively simple to adapt the backpropagation algorithm to operate in a multithreaded manner.
 
The training data is broken up into equally large batches for each of the threads.  Each thread executes the forward and backward propagations. The weight and threshold deltas are summed for each of the threads. At the end of each iteration all threads must pause briefly for the weight and threshold deltas to be summed and applied to the neural network. This process continues for each iteration. This multithreaded approach to backpropagation is used by the [[Encog|Encog Neural Network Framework]].<ref name="MultiProp">J. Heaton http://www.heatonresearch.com/encog/mprop/compare.html Applying Multithreading to Resilient Propagation and Backpropagation</ref>
 
==Limitations==
{{Unreferenced section|date=December 2012}}
* The result may converge to a [[Maxima and minima|local minimum]]. The "hill climbing" strategy of gradient descent is guaranteed to work if there is only one minimum. However, oftentimes the error surface has many local minima and maxima. If the starting point of the gradient descent happens to be somewhere between a local maximum and local minimum, then going down the direction with the most negative gradient will lead to the local minimum. [[File:Extrema example.svg|thumb|250px|Gradient descent can find the local minimum instead of the global minimum]]
* The convergence obtained from backpropagation learning is very slow.
* The convergence in backpropagation learning is not guaranteed.
* Backpropagation learning does not require normalization of input vectors; however, normalization could improve performance.<ref>ISBN: 1-931841-08-X,</ref>
 
== History ==
 
{{See also|Perceptron#History|label 1=History of Perceptron}}
 
[[Vapnik]] cites (Bryson, A.E.; W.F. Denham; S.E. Dreyfus. Optimal programming problems with inequality constraints. I: Necessary conditions for extremal solutions. AIAA J. 1, 11 (1963) 2544-2550)  as the first publication of the backpropagation algorithm in his book "Support Vector Machines.".  [[Arthur E. Bryson]] and [[Yu-Chi Ho]] described it as a multi-stage dynamic system optimization method in 1969.<ref>{{cite book|title=Artificial Intelligence A Modern Approach|author=[[Stuart Russell]] and [[Peter Norvig]]|quote=The most popular method for learning in multilayer networks is called Back-propagation. It was first invented in 1969 by Bryson and Ho, but was largely ignored until the mid-1980s.|page=578}}</ref><ref>{{cite book|title=Applied optimal control: optimization, estimation, and control|authors=Arthur Earl Bryson, Yu-Chi Ho|year=1969|pages=481|publisher=Blaisdell Publishing Company or Xerox College Publishing}}</ref>  It wasn't until 1974 and later, when applied in the context of neural networks and through the work of [[Paul Werbos]],<ref>Paul J. Werbos. Beyond Regression: New Tools for Prediction and Analysis in the Behavioral Sciences. PhD thesis, Harvard University, 1974</ref> [[David E. Rumelhart]], [[Geoffrey E. Hinton]] and [[Ronald J. Williams]],<ref name=Alpaydin2010>{{cite book|last=Alpaydın|first=Ethem|title=Introduction to machine learning|year=2010|publisher=MIT Press|location=Cambridge, Mass.|isbn=978-0-262-01243-0|edition=2nd ed.|quote=...and hence the name ''backpropagation'' was coined (Rumelhart, Hinton, and Williams 1986a).|page=250}}</ref><ref name=Rumelhart1986>{{cite journal|last=Rumelhart|first=David E.|coauthors=Hinton, Geoffrey E., Williams, Ronald J.|title=Learning representations by back-propagating errors|journal=Nature|date=8 October 1986|volume=323|issue=6088|pages=533–536|doi=10.1038/323533a0}}</ref> that it gained recognition, and it led to a “renaissance” in the field of artificial neural network research.  During the 2000s it fell out of favour but has returned again in the 2010s, now able to train much larger networks using huge modern computing power such as [[GPU]]s.  For example, in 2013 top speech recognisers now use backpropagation-trained neural networks.
 
==Notes==
{{Reflist|group=note}}
 
==References==
{{reflist|2}}
 
== External links ==
*[http://msdn.microsoft.com/en-us/magazine/jj658979.aspx Neural Network Back-Propagation for Programmers (a tutorial)]
*[http://www.matematica.ciens.ucv.ve/dcrespin/Pub/backprop.pdf Backpropagation for mathematicians]
* Chapter 7 [http://page.mi.fu-berlin.de/rojas/neural/chapter/K7.pdf The backpropagation algorithm] of [http://page.mi.fu-berlin.de/rojas/neural/index.html.html ''Neural Networks - A Systematic Introduction''] by [[Raúl Rojas]] (ISBN 978-3540605058)
*[http://www.codeproject.com/KB/recipes/BP.aspx Implementation of BackPropagation in C++]
*[http://www.codeproject.com/KB/cs/BackPropagationNeuralNet.aspx Implementation of BackPropagation in C#]
*[http://sourceforge.net/projects/backprop1 Implementation of BackPropagation in Java]
*[http://ai4r.org/neuralNetworks.html Implementation of BackPropagation in Ruby]
*[http://arctrix.com/nas/python/bpnn.py Implementation of BackPropagation in Python]
*[http://freedelta.free.fr/r/php-code-samples/artificial-intelligence-neural-network-backpropagation/ Implementation of BackPropagation in PHP]
*[http://www.tek271.com/documents/others/into-to-neural-networks Quick explanation of the backpropagation algorithm]
*[http://galaxy.agh.edu.pl/~vlsi/AI/backp_t_en/backprop.html Graphical explanation of the backpropagation algorithm]
*[http://www.speech.sri.com/people/anand/771/html/node37.html Concise explanation of the backpropagation algorithm using math notation] by Anand Venkataraman
*[http://en.wikiversity.org/wiki/Learning_and_Neural_Networks Backpropagation neural network tutorial at the Wikiversity]
 
[[Category:Machine learning algorithms]]
[[Category:Neural networks]]
[[Category:Articles with example pseudocode]]

Latest revision as of 08:11, 11 December 2014

Hello. Let me introduce the author. Her title is Refugia Shryock. Hiring is her day job now over the counter std test at home std testing but she's always wanted her personal company. One of the extremely best things in the world for me is to do aerobics at home std test and I've been performing it for quite a while. Puerto Rico is where he's always been living but she requirements to move because of her family.

Feel free to surf to my webpage - at home std test (find more information)