Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Backpropagation

From Wikipedia, the free encyclopedia
Optimization algorithm for artificial neural networks
This article is about the computer algorithm. For the biological process, seeNeural backpropagation.
Backpropagation can also refer to the way the result of a playout is propagated up the search tree inMonte Carlo tree search.
Part of a series on
Machine learning
anddata mining

Inmachine learning,backpropagation is agradient computation method commonly used for training aneural network in computing parameter updates.

It is an efficient application of thechain rule to neural networks. Backpropagation computes the gradient of aloss function with respect to theweights of the network for a single input–output example, and does soefficiently, computing the gradient one layer at a time,iterating backward from the last layer to avoid redundant calculations of intermediate terms in the chain rule; this can be derived throughdynamic programming.[1][2][3]

Strictly speaking, the termbackpropagation refers only to an algorithm for efficiently computing the gradient, not how the gradient is used; but the term is often used loosely to refer to the entire learning algorithm. This includes changing model parameters in the negative direction of the gradient, such as bystochastic gradient descent, or as an intermediate step in a more complicated optimizer, such asAdaptive Moment Estimation.[4]

Backpropagation had multiple discoveries and partial discoveries, with a tangled history and terminology. See thehistory section for details. Some other names for the technique include "reverse mode ofautomatic differentiation" or "reverse accumulation".[5]

Overview

[edit]

Backpropagation computes the gradient inweight space of a feedforward neural network, with respect to aloss function. Denote:

In the derivation of backpropagation, other intermediate quantities are used by introducing them as needed below. Bias terms are not treated specially since they correspond to a weight with a fixed input of 1. For backpropagation the specific loss function and activation functions do not matter as long as they and their derivatives can be evaluated efficiently. Traditional activation functions include sigmoid,tanh, andReLU.Swish,[6]Mish,[7] and many others.

The overall network is a combination offunction composition andmatrix multiplication:

g(x):=fL(WLfL1(WL1f1(W1x))){\displaystyle g(x):=f^{L}(W^{L}f^{L-1}(W^{L-1}\cdots f^{1}(W^{1}x)\cdots ))}

For a training set there will be a set of input–output pairs,{(xi,yi)}{\displaystyle \left\{(x_{i},y_{i})\right\}}. For each input–output pair(xi,yi){\displaystyle (x_{i},y_{i})} in the training set, the loss of the model on that pair is the cost of the difference between the predicted outputg(xi){\displaystyle g(x_{i})} and the target outputyi{\displaystyle y_{i}}:

C(yi,g(xi)){\displaystyle C(y_{i},g(x_{i}))}

Note the distinction: during model evaluation the weights are fixed while the inputs vary (and the target output may be unknown), and the network ends with the output layer (it does not include the loss function). During model training the input–output pair is fixed while the weights vary, and the network ends with the loss function.

Backpropagation computes the gradient for afixed input–output pair(xi,yi){\displaystyle (x_{i},y_{i})}, where the weightswjkl{\displaystyle w_{jk}^{l}} can vary. Each individual component of the gradient,C/wjkl,{\displaystyle \partial C/\partial w_{jk}^{l},} can be computed by the chain rule; but doing this separately for each weight is inefficient. Backpropagation efficiently computes the gradient by avoiding duplicate calculations and not computing unnecessary intermediate values, by computing the gradient of each layer – specifically the gradient of the weightedinput of each layer, denoted byδl{\displaystyle \delta ^{l}} – from back to front.

Informally, the key point is that since the only way a weight inWl{\displaystyle W^{l}} affects the loss is through its effect on thenext layer, and it does solinearly,δl{\displaystyle \delta ^{l}} are the only data you need to compute the gradients of the weights at layerl{\displaystyle l}, and then the gradients of weights of previous layer can be computed byδl1{\displaystyle \delta ^{l-1}} and repeated recursively. This avoids inefficiency in two ways. First, it avoids duplication because when computing the gradient at layerl{\displaystyle l}, it is unnecessary to recompute all derivatives on later layersl+1,l+2,{\displaystyle l+1,l+2,\ldots } each time. Second, it avoids unnecessary intermediate calculations, because at each stage it directly computes the gradient of the weights with respect to the ultimate output (the loss), rather than unnecessarily computing the derivatives of the values of hidden layers with respect to changes in weightsajl/wjkl{\displaystyle \partial a_{j'}^{l'}/\partial w_{jk}^{l}}.

Backpropagation can be expressed for simple feedforward networks in terms ofmatrix multiplication, or more generally in terms of theadjoint graph.

Matrix multiplication

[edit]

For the basic case of a feedforward network, where nodes in each layer are connected only to nodes in the immediate next layer (without skipping any layers), and there is a loss function that computes a scalar loss for the final output, backpropagation can be understood simply by matrix multiplication.[c] Essentially, backpropagation evaluates the expression for the derivative of the cost function as a product of derivatives between each layerfrom right to left – "backwards" – with the gradient of the weights between each layer being a simple modification of the partial products (the "backwards propagated error").

Given an input–output pair(x,y){\displaystyle (x,y)}, the loss is:

C(y,fL(WLfL1(WL1f2(W2f1(W1x))))){\displaystyle C(y,f^{L}(W^{L}f^{L-1}(W^{L-1}\cdots f^{2}(W^{2}f^{1}(W^{1}x))\cdots )))}

To compute this, one starts with the inputx{\displaystyle x} and works forward; denote the weighted input of each hidden layer aszl{\displaystyle z^{l}} and the output of hidden layerl{\displaystyle l} as the activational{\displaystyle a^{l}}. For backpropagation, the activational{\displaystyle a^{l}} as well as the derivatives(fl){\displaystyle (f^{l})'} (evaluated atzl{\displaystyle z^{l}}) must be cached for use during the backwards pass.

The derivative of the loss in terms of the inputs is given by the chain rule; note that each term is atotal derivative, evaluated at the value of the network (at each node) on the inputx{\displaystyle x}:

dCdaLdaLdzLdzLdaL1daL1dzL1dzL1daL2da1dz1z1x,{\displaystyle {\frac {dC}{da^{L}}}\cdot {\frac {da^{L}}{dz^{L}}}\cdot {\frac {dz^{L}}{da^{L-1}}}\cdot {\frac {da^{L-1}}{dz^{L-1}}}\cdot {\frac {dz^{L-1}}{da^{L-2}}}\cdot \ldots \cdot {\frac {da^{1}}{dz^{1}}}\cdot {\frac {\partial z^{1}}{\partial x}},}

wheredaLdzL{\displaystyle {\frac {da^{L}}{dz^{L}}}} is adiagonal matrix.

These terms are: the derivative of the loss function;[d] the derivatives of the activation functions;[e] and the matrices of weights:[f]

dCdaL(fL)WL(fL1)WL1(f1)W1.{\displaystyle {\frac {dC}{da^{L}}}\circ (f^{L})'\cdot W^{L}\circ (f^{L-1})'\cdot W^{L-1}\circ \cdots \circ (f^{1})'\cdot W^{1}.}

The gradient{\displaystyle \nabla } is thetranspose of the derivative of the output in terms of the input, so the matrices are transposed and the order of multiplication is reversed, but the entries are the same:

xC=(W1)T(f1)(WL1)T(fL1)(WL)T(fL)aLC.{\displaystyle \nabla _{x}C=(W^{1})^{T}\cdot (f^{1})'\circ \ldots \circ (W^{L-1})^{T}\cdot (f^{L-1})'\circ (W^{L})^{T}\cdot (f^{L})'\circ \nabla _{a^{L}}C.}

Backpropagation then consists essentially of evaluating this expression from right to left (equivalently, multiplying the previous expression for the derivative from left to right), computing the gradient at each layer on the way; there is an added step, because the gradient of the weights is not just a subexpression: there's an extra multiplication.

Introducing the auxiliary quantityδl{\displaystyle \delta ^{l}} for the partial products (multiplying from right to left), interpreted as the "error at levell{\displaystyle l}" and defined as the gradient of the input values at levell{\displaystyle l}:

δl:=(fl)(Wl+1)T(fl+1)(WL1)T(fL1)(WL)T(fL)aLC.{\displaystyle \delta ^{l}:=(f^{l})'\circ (W^{l+1})^{T}\cdot (f^{l+1})'\circ \cdots \circ (W^{L-1})^{T}\cdot (f^{L-1})'\circ (W^{L})^{T}\cdot (f^{L})'\circ \nabla _{a^{L}}C.}

Note thatδl{\displaystyle \delta ^{l}} is a vector, of length equal to the number of nodes in levell{\displaystyle l}; each component is interpreted as the "cost attributable to (the value of) that node".

The gradient of the weights in layerl{\displaystyle l} is then:

WlC=δl(al1)T.{\displaystyle \nabla _{W^{l}}C=\delta ^{l}(a^{l-1})^{T}.}

The factor ofal1{\displaystyle a^{l-1}} is because the weightsWl{\displaystyle W^{l}} between levell1{\displaystyle l-1} andl{\displaystyle l} affect levell{\displaystyle l} proportionally to the inputs (activations): the inputs are fixed, the weights vary.

Theδl{\displaystyle \delta ^{l}} can easily be computed recursively, going from right to left, as:

δl1:=(fl1)(Wl)Tδl.{\displaystyle \delta ^{l-1}:=(f^{l-1})'\circ (W^{l})^{T}\cdot \delta ^{l}.}

The gradients of the weights can thus be computed using a few matrix multiplications for each level; this is backpropagation.

Compared with naively computing forwards (using theδl{\displaystyle \delta ^{l}} for illustration):

δ1=(f1)(W2)T(f2)(WL1)T(fL1)(WL)T(fL)aLCδ2=(f2)(WL1)T(fL1)(WL)T(fL)aLCδL1=(fL1)(WL)T(fL)aLCδL=(fL)aLC,{\displaystyle {\begin{aligned}\delta ^{1}&=(f^{1})'\circ (W^{2})^{T}\cdot (f^{2})'\circ \cdots \circ (W^{L-1})^{T}\cdot (f^{L-1})'\circ (W^{L})^{T}\cdot (f^{L})'\circ \nabla _{a^{L}}C\\\delta ^{2}&=(f^{2})'\circ \cdots \circ (W^{L-1})^{T}\cdot (f^{L-1})'\circ (W^{L})^{T}\cdot (f^{L})'\circ \nabla _{a^{L}}C\\&\vdots \\\delta ^{L-1}&=(f^{L-1})'\circ (W^{L})^{T}\cdot (f^{L})'\circ \nabla _{a^{L}}C\\\delta ^{L}&=(f^{L})'\circ \nabla _{a^{L}}C,\end{aligned}}}

There are two key differences with backpropagation:

  1. Computingδl1{\displaystyle \delta ^{l-1}} in terms ofδl{\displaystyle \delta ^{l}} avoids the obvious duplicate multiplication of layersl{\displaystyle l} and beyond.
  2. Multiplying starting fromaLC{\displaystyle \nabla _{a^{L}}C} – propagating the errorbackwards – means that each step simply multiplies a vector (δl{\displaystyle \delta ^{l}}) by the matrices of weights(Wl)T{\displaystyle (W^{l})^{T}} and derivatives of activations(fl1){\displaystyle (f^{l-1})'}. By contrast, multiplying forwards, starting from the changes at an earlier layer, means that each multiplication multiplies amatrix by amatrix. This is much more expensive, and corresponds to tracking every possible path of a change in one layerl{\displaystyle l} forward to changes in the layerl+2{\displaystyle l+2} (for multiplyingWl+1{\displaystyle W^{l+1}} byWl+2{\displaystyle W^{l+2}}, with additional multiplications for the derivatives of the activations), which unnecessarily computes the intermediate quantities of how weight changes affect the values of hidden nodes.

Adjoint graph

[edit]
[icon]
This sectionneeds expansion. You can help byadding missing information.(November 2019)

For more general graphs, and other advanced variations, backpropagation can be understood in terms ofautomatic differentiation, where backpropagation is a special case ofreverse accumulation (or "reverse mode").[5]

Intuition

[edit]

Motivation

[edit]

The goal of anysupervised learning algorithm is to find a function that best maps a set of inputs to their correct output. The motivation for backpropagation is to train a multi-layered neural network such that it can learn the appropriate internal representations to allow it to learn any arbitrary mapping of input to output.[8]

Learning as an optimization problem

[edit]

To understand the mathematical derivation of the backpropagation algorithm, it helps to first develop some intuition about the relationship between the actual output of a neuron and the correct output for a particular training example. Consider a simple neural network with two input units, one output unit and no hidden units, and in which each neuron uses alinear output (unlike most work on neural networks, in which mapping from inputs to outputs is non-linear)[g] that is the weighted sum of its input.

A simple neural network with two input units (each with a single input) and one output unit (with two inputs)

Initially, before training, the weights will be set randomly. Then the neuron learns fromtraining examples, which in this case consist of a set oftuples(x1,x2,t){\displaystyle (x_{1},x_{2},t)} wherex1{\displaystyle x_{1}} andx2{\displaystyle x_{2}} are the inputs to the network andt is the correct output (the output the network should produce given those inputs, when it has been trained). The initial network, givenx1{\displaystyle x_{1}} andx2{\displaystyle x_{2}}, will compute an outputy that likely differs fromt (given random weights). Aloss functionL(t,y){\displaystyle L(t,y)} is used for measuring the discrepancy between the target outputt and the computed outputy. Forregression analysis problems the squared error can be used as a loss function, forclassification thecategorical cross-entropy can be used.

As an example consider a regression problem using the square error as a loss:

L(t,y)=(ty)2=E,{\displaystyle L(t,y)=(t-y)^{2}=E,}

whereE is the discrepancy or error.

Consider the network on a single training case:(1,1,0){\displaystyle (1,1,0)}. Thus, the inputx1{\displaystyle x_{1}} andx2{\displaystyle x_{2}} are 1 and 1 respectively and the correct output,t is 0. Now if the relation is plotted between the network's outputy on the horizontal axis and the errorE on the vertical axis, the result is a parabola. Theminimum of theparabola corresponds to the outputy which minimizes the errorE. For a single training case, the minimum also touches the horizontal axis, which means the error will be zero and the network can produce an outputy that exactly matches the target outputt. Therefore, the problem of mapping inputs to outputs can be reduced to anoptimization problem of finding a function that will produce the minimal error.

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:

y=x1w1+x2w2,{\displaystyle y=x_{1}w_{1}+x_{2}w_{2},}

wherew1{\displaystyle w_{1}} andw2{\displaystyle w_{2}} 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.

In this example, upon injecting the training data(1,1,0){\displaystyle (1,1,0)}, the loss function becomes

E=(ty)2=y2=(x1w1+x2w2)2=(w1+w2)2.{\displaystyle E=(t-y)^{2}=y^{2}=(x_{1}w_{1}+x_{2}w_{2})^{2}=(w_{1}+w_{2})^{2}.}

Then, the loss functionE{\displaystyle E} takes the form of a parabolic cylinder with its base directed alongw1=w2{\displaystyle w_{1}=-w_{2}}. Since all sets of weights that satisfyw1=w2{\displaystyle w_{1}=-w_{2}} minimize the loss function, in this case additional constraints are required to converge to a unique solution. Additional constraints could either be generated by setting specific conditions to the weights, or by injecting additional training data.

One commonly used algorithm to find the set of weights that minimizes the error isgradient descent. By backpropagation, the steepest descent direction is calculated of the loss function versus the present synaptic weights. Then, the weights can be modified along the steepest descent direction, and the error is minimized in an efficient way.

Derivation

[edit]

The gradient descent method involves calculating the derivative of the loss function with respect to the weights of the network. This is normally done using backpropagation. Assuming one output neuron,[h] the squared error function is

E=L(t,y){\displaystyle E=L(t,y)}

where

L{\displaystyle L} is the loss for the outputy{\displaystyle y} and target valuet{\displaystyle t},
t{\displaystyle t} is the target output for a training sample, and
y{\displaystyle y} is the actual output of the output neuron.

In this section, the order of the weight indexes are reversed relative to the prior section:wij{\displaystyle w_{ij}} is weight from thei{\displaystyle i}th to thej{\displaystyle j}th unit.[i] For each neuronj{\displaystyle j}, its outputoj{\displaystyle o_{j}} is defined as

oj=φ(netj)=φ(k=1nwkjxk),{\displaystyle o_{j}=\varphi ({\text{net}}_{j})=\varphi \left(\sum _{k=1}^{n}w_{kj}x_{k}\right),}

where theactivation functionφ{\displaystyle \varphi } isnon-linear anddifferentiable over the activation region (the ReLU is not differentiable at one point). A historically used activation function is thelogistic function:

φ(z)=11+ez{\displaystyle \varphi (z)={\frac {1}{1+e^{-z}}}}

which has aconvenient derivative of:

dφdz=φ(z)(1φ(z)){\displaystyle {\frac {d\varphi }{dz}}=\varphi (z)(1-\varphi (z))}

The inputnetj{\displaystyle {\text{net}}_{j}} to a neuron is the weighted sum of outputsok{\displaystyle o_{k}} of previous neurons. If the neuron is in the first layer after the input layer, theok{\displaystyle o_{k}} of the input layer are simply the inputsxk{\displaystyle x_{k}} to the network. The number of input units to the neuron isn{\displaystyle n}. The variablewkj{\displaystyle w_{kj}} denotes the weight between neuronk{\displaystyle k} of the previous layer and neuronj{\displaystyle j} of the current layer.

Finding the derivative of the error

[edit]
Diagram of an artificial neural network to illustrate the notation used here

Calculating thepartial derivative of the error with respect to a weightwij{\displaystyle w_{ij}} is done using thechain rule twice:

Ewij=Eojojwij=Eojojnetjnetjwij{\displaystyle {\frac {\partial E}{\partial w_{ij}}}={\frac {\partial E}{\partial o_{j}}}{\frac {\partial o_{j}}{\partial w_{ij}}}={\frac {\partial E}{\partial o_{j}}}{\frac {\partial o_{j}}{\partial {\text{net}}_{j}}}{\frac {\partial {\text{net}}_{j}}{\partial w_{ij}}}}Eq. 1

In the last factor of the right-hand side of the above, only one term in the sumnetj{\displaystyle {\text{net}}_{j}} depends onwij{\displaystyle w_{ij}}, so that

netjwij=wij(k=1nwkjok)=wijwijoi=oi.{\displaystyle {\frac {\partial {\text{net}}_{j}}{\partial w_{ij}}}={\frac {\partial }{\partial w_{ij}}}\left(\sum _{k=1}^{n}w_{kj}o_{k}\right)={\frac {\partial }{\partial w_{ij}}}w_{ij}o_{i}=o_{i}.}Eq. 2

If the neuron is in the first layer after the input layer,oi{\displaystyle o_{i}} is justxi{\displaystyle x_{i}}.

The derivative of the output of neuronj{\displaystyle j} with respect to its input is simply the partial derivative of the activation function:

ojnetj=φ(netj)netj{\displaystyle {\frac {\partial o_{j}}{\partial {\text{net}}_{j}}}={\frac {\partial \varphi ({\text{net}}_{j})}{\partial {\text{net}}_{j}}}}Eq. 3

which for thelogistic activation function

ojnetj=netjφ(netj)=φ(netj)(1φ(netj))=oj(1oj){\displaystyle {\frac {\partial o_{j}}{\partial {\text{net}}_{j}}}={\frac {\partial }{\partial {\text{net}}_{j}}}\varphi ({\text{net}}_{j})=\varphi ({\text{net}}_{j})(1-\varphi ({\text{net}}_{j}))=o_{j}(1-o_{j})}

This is the reason why backpropagation requires that the activation function bedifferentiable. (Nevertheless, theReLU activation function, which is non-differentiable at 0, has become quite popular, e.g. inAlexNet)

The first factor is straightforward to evaluate if the neuron is in the output layer, because thenoj=y{\displaystyle o_{j}=y} and

Eoj=Ey{\displaystyle {\frac {\partial E}{\partial o_{j}}}={\frac {\partial E}{\partial y}}}Eq. 4

If half of the square error is used as loss function we can rewrite it as

Eoj=Ey=y12(ty)2=yt{\displaystyle {\frac {\partial E}{\partial o_{j}}}={\frac {\partial E}{\partial y}}={\frac {\partial }{\partial y}}{\frac {1}{2}}(t-y)^{2}=y-t}

However, ifj{\displaystyle j} is in an arbitrary inner layer of the network, finding the derivativeE{\displaystyle E} with respect tooj{\displaystyle o_{j}} is less obvious.

ConsideringE{\displaystyle E} as a function with the inputs being all neuronsL={u,v,,w}{\displaystyle L=\{u,v,\dots ,w\}} receiving input from neuronj{\displaystyle j},

E(oj)oj=E(netu,netv,,netw)oj{\displaystyle {\frac {\partial E(o_{j})}{\partial o_{j}}}={\frac {\partial E(\mathrm {net} _{u},{\text{net}}_{v},\dots ,\mathrm {net} _{w})}{\partial o_{j}}}}

and taking thetotal derivative with respect tooj{\displaystyle o_{j}}, a recursive expression for the derivative is obtained:

Eoj=L(Enetnetoj)=L(Eoonetnetoj)=L(Eoonetwj){\displaystyle {\frac {\partial E}{\partial o_{j}}}=\sum _{\ell \in L}\left({\frac {\partial E}{\partial {\text{net}}_{\ell }}}{\frac {\partial {\text{net}}_{\ell }}{\partial o_{j}}}\right)=\sum _{\ell \in L}\left({\frac {\partial E}{\partial o_{\ell }}}{\frac {\partial o_{\ell }}{\partial {\text{net}}_{\ell }}}{\frac {\partial {\text{net}}_{\ell }}{\partial o_{j}}}\right)=\sum _{\ell \in L}\left({\frac {\partial E}{\partial o_{\ell }}}{\frac {\partial o_{\ell }}{\partial {\text{net}}_{\ell }}}w_{j\ell }\right)}Eq. 5

Therefore, the derivative with respect tooj{\displaystyle o_{j}} can be calculated if all the derivatives with respect to the outputso{\displaystyle o_{\ell }} of the next layer – the ones closer to the output neuron – are known. [Note, if any of the neurons in setL{\displaystyle L} were not connected to neuronj{\displaystyle j}, they would be independent ofwij{\displaystyle w_{ij}} and the corresponding partial derivative under the summation would vanish to 0.]

SubstitutingEq. 2,Eq. 3Eq.4 andEq. 5 inEq. 1 we obtain:

Ewij=Eojojnetjnetjwij=Eojojnetjoi{\displaystyle {\frac {\partial E}{\partial w_{ij}}}={\frac {\partial E}{\partial o_{j}}}{\frac {\partial o_{j}}{\partial {\text{net}}_{j}}}{\frac {\partial {\text{net}}_{j}}{\partial w_{ij}}}={\frac {\partial E}{\partial o_{j}}}{\frac {\partial o_{j}}{\partial {\text{net}}_{j}}}o_{i}}
Ewij=oiδj{\displaystyle {\frac {\partial E}{\partial w_{ij}}}=o_{i}\delta _{j}}

with

δj=Eojojnetj={L(t,oj)ojdφ(netj)dnetjif j is an output neuron,(Lwjδ)dφ(netj)dnetjif j is an inner neuron.{\displaystyle \delta _{j}={\frac {\partial E}{\partial o_{j}}}{\frac {\partial o_{j}}{\partial {\text{net}}_{j}}}={\begin{cases}{\frac {\partial L(t,o_{j})}{\partial o_{j}}}{\frac {d\varphi ({\text{net}}_{j})}{d{\text{net}}_{j}}}&{\text{if }}j{\text{ is an output neuron,}}\\(\sum _{\ell \in L}w_{j\ell }\delta _{\ell }){\frac {d\varphi ({\text{net}}_{j})}{d{\text{net}}_{j}}}&{\text{if }}j{\text{ is an inner neuron.}}\end{cases}}}

ifφ{\displaystyle \varphi } is the logistic function, and the error is the square error:

δj=Eojojnetj={(ojtj)oj(1oj)if j is an output neuron,(Lwjδ)oj(1oj)if j is an inner neuron.{\displaystyle \delta _{j}={\frac {\partial E}{\partial o_{j}}}{\frac {\partial o_{j}}{\partial {\text{net}}_{j}}}={\begin{cases}(o_{j}-t_{j})o_{j}(1-o_{j})&{\text{if }}j{\text{ is an output neuron,}}\\(\sum _{\ell \in L}w_{j\ell }\delta _{\ell })o_{j}(1-o_{j})&{\text{if }}j{\text{ is an inner neuron.}}\end{cases}}}

To update the weightwij{\displaystyle w_{ij}} using gradient descent, one must choose a learning rate,η>0{\displaystyle \eta >0}. The change in weight needs to reflect the impact onE{\displaystyle E} of an increase or decrease inwij{\displaystyle w_{ij}}. IfEwij>0{\displaystyle {\frac {\partial E}{\partial w_{ij}}}>0}, an increase inwij{\displaystyle w_{ij}} increasesE{\displaystyle E}; conversely, ifEwij<0{\displaystyle {\frac {\partial E}{\partial w_{ij}}}<0}, an increase inwij{\displaystyle w_{ij}} decreasesE{\displaystyle E}. The newΔwij{\displaystyle \Delta w_{ij}} is added to the old weight, and the product of the learning rate and the gradient, multiplied by1{\displaystyle -1} guarantees thatwij{\displaystyle w_{ij}} changes in a way that always decreasesE{\displaystyle E}. In other words, in the equation immediately below,ηEwij{\displaystyle -\eta {\frac {\partial E}{\partial w_{ij}}}} always changeswij{\displaystyle w_{ij}} in such a way thatE{\displaystyle E} is decreased:

Δwij=ηEwij=ηoiδj{\displaystyle \Delta w_{ij}=-\eta {\frac {\partial E}{\partial w_{ij}}}=-\eta o_{i}\delta _{j}}

Second-order gradient descent

[edit]

Using aHessian matrix of second-order derivatives of the error function, theLevenberg–Marquardt algorithm often converges faster than first-order gradient descent, especially when the topology of the error function is complicated.[9][10] It may also find solutions in smaller node counts for which other methods might not converge.[10] The Hessian can be approximated by theFisher information matrix.[11]

As an example, consider a simple feedforward network. At thel{\displaystyle l}-th layer, we havexi(l),ai(l)=f(xi(l)),xi(l+1)=jWijaj(l){\displaystyle x_{i}^{(l)},\quad a_{i}^{(l)}=f(x_{i}^{(l)}),\quad x_{i}^{(l+1)}=\sum _{j}W_{ij}a_{j}^{(l)}}wherex{\displaystyle x} are the pre-activations,a{\displaystyle a} are the activations, andW{\displaystyle W} is the weight matrix. Given a loss functionL{\displaystyle L}, the first-order backpropagation states thatLaj(l)=jWijLxi(l+1),Lxj(l)=f(xj(l))Laj(l){\displaystyle {\frac {\partial L}{\partial a_{j}^{(l)}}}=\sum _{j}W_{ij}{\frac {\partial L}{\partial x_{i}^{(l+1)}}},\quad {\frac {\partial L}{\partial x_{j}^{(l)}}}=f'(x_{j}^{(l)}){\frac {\partial L}{\partial a_{j}^{(l)}}}}and the second-order backpropagation states that2Laj1(l)aj2(l)=j1j2Wi1j1Wi2j22Lxi1(l+1)xi2(l+1),2Lxj1(l)xj2(l)=f(xj1(l))f(xj2(l))2Laj1(l)aj2(l)+δj1j2f(xj1(l))Laj1(l){\displaystyle {\frac {\partial ^{2}L}{\partial a_{j_{1}}^{(l)}\partial a_{j_{2}}^{(l)}}}=\sum _{j_{1}j_{2}}W_{i_{1}j_{1}}W_{i_{2}j_{2}}{\frac {\partial ^{2}L}{\partial x_{i_{1}}^{(l+1)}\partial x_{i_{2}}^{(l+1)}}},\quad {\frac {\partial ^{2}L}{\partial x_{j_{1}}^{(l)}\partial x_{j_{2}}^{(l)}}}=f'(x_{j_{1}}^{(l)})f'(x_{j_{2}}^{(l)}){\frac {\partial ^{2}L}{\partial a_{j_{1}}^{(l)}\partial a_{j_{2}}^{(l)}}}+\delta _{j_{1}j_{2}}f''(x_{j_{1}}^{(l)}){\frac {\partial L}{\partial a_{j_{1}}^{(l)}}}}whereδ{\displaystyle \delta } is theDirac delta symbol.

Arbitrary-order derivatives in arbitrary computational graphs can be computed with backpropagation, but with more complex expressions for higher orders.

Loss function

[edit]
Further information:Loss function

The loss function is a function that maps values of one or more variables onto areal number intuitively representing some "cost" associated with those values. For backpropagation, the loss function calculates the difference between the network output and its expected output, after a training example has propagated through the network.

Assumptions

[edit]

The mathematical expression of the loss function must fulfill two conditions in order for it to be possibly used in backpropagation.[12] The first is that it can be written as an averageE=1nxEx{\textstyle E={\frac {1}{n}}\sum _{x}E_{x}} over error functionsEx{\textstyle E_{x}}, forn{\textstyle n} individual training examples,x{\textstyle x}. The reason for this assumption is that the backpropagation algorithm calculates the gradient of the error function for a single training example, which needs to be generalized to the overall error function. The second assumption is that it can be written as a function of the outputs from the neural network.

Example loss function

[edit]

Lety,y{\displaystyle y,y'} be vectors inRn{\displaystyle \mathbb {R} ^{n}}.

Select an error functionE(y,y){\displaystyle E(y,y')} measuring the difference between two outputs. The standard choice is the square of theEuclidean distance between the vectorsy{\displaystyle y} andy{\displaystyle y'}:E(y,y)=12yy2{\displaystyle E(y,y')={\tfrac {1}{2}}\lVert y-y'\rVert ^{2}}The error function overn{\textstyle n} training examples can then be written as an average of losses over individual examples:E=12nx(y(x)y(x))2{\displaystyle E={\frac {1}{2n}}\sum _{x}\lVert (y(x)-y'(x))\rVert ^{2}}

Limitations

[edit]
Gradient descent may find a local minimum instead of the global minimum.
  • Gradient descent with backpropagation is not guaranteed to find theglobal minimum of the error function, but only a local minimum; also, it has trouble crossingplateaus in the error function landscape. This issue, caused by thenon-convexity of error functions in neural networks, was long thought to be a major drawback, butYann LeCunet al. argue that in many practical problems, it is not.[13]
  • Backpropagation learning does not require normalization of input vectors; however, normalization could improve performance.[14]
  • Backpropagation requires the derivatives of activation functions to be known at network design time.

History

[edit]
See also:History of perceptron

Precursors

[edit]

Backpropagation had been derived repeatedly, as it is essentially an efficient application of thechain rule (first written down byGottfried Wilhelm Leibniz in 1676)[15][16] to neural networks.

The terminology "back-propagating error correction" was introduced in 1962 byFrank Rosenblatt, but he did not know how to implement this.[17] In any case, he only studied neurons whose outputs were discrete levels, which only had zero derivatives, making backpropagation impossible.

Precursors to backpropagation appeared inoptimal control theory since 1950s.Yann LeCun et al credits 1950s work byPontryagin and others in optimal control theory, especially theadjoint state method, for being a continuous-time version of backpropagation.[18]Hecht-Nielsen[19] credits theRobbins–Monro algorithm (1951)[20] andArthur Bryson andYu-Chi Ho'sApplied Optimal Control (1969) as presages of backpropagation. Other precursors wereHenry J. Kelley 1960,[1] andArthur E. Bryson (1961).[2] In 1962,Stuart Dreyfus published a simpler derivation based only on thechain rule.[21][22][23] In 1973, he adaptedparameters of controllers in proportion to error gradients.[24] Unlike modern backpropagation, these precursors used standard Jacobian matrix calculations from one stage to the previous one, neither addressing direct links across several stages nor potential additional efficiency gains due to network sparsity.[25]

TheADALINE (1960) learning algorithm was gradient descent with a squared error loss for a single layer. The firstmultilayer perceptron (MLP) with more than one layer trained bystochastic gradient descent[20] was published in 1967 byShun'ichi Amari.[26] The MLP had 5 layers, with 2 learnable layers, and it learned to classify patterns not linearly separable.[25]

Modern backpropagation

[edit]

Modern backpropagation was first published bySeppo Linnainmaa as "reverse mode ofautomatic differentiation" (1970)[27] for discrete connected networks of nesteddifferentiable functions.[28][29][30]

In 1982,Paul Werbos applied backpropagation to MLPs in the way that has become standard.[31][32] Werbos described how he developed backpropagation in an interview. In 1971, during his PhD work, he developed backpropagation to mathematicizeFreud's "flow of psychic energy". He faced repeated difficulty in publishing the work, only managing in 1981.[33] He also claimed that "the first practical application of back-propagation was for estimating a dynamic model to predict nationalism and social communications in 1974" by him.[34]

Around 1982,[33]: 376 David E. Rumelhart independently developed[35]: 252  backpropagation and taught the algorithm to others in his research circle. He did not cite previous work as he was unaware of them. He published the algorithm first in a 1985 paper, then in a 1986Nature paper an experimental analysis of the technique.[36] These papers became highly cited, contributed to the popularization of backpropagation, and coincided with the resurging research interest in neural networks during the 1980s.[8][37][38]

In 1985, the method was also described by David Parker.[39][40]Yann LeCun proposed an alternative form of backpropagation for neural networks in his PhD thesis in 1987.[41]

Gradient descent took a considerable amount of time to reach acceptance. Some early objections were: there were no guarantees that gradient descent could reach a global minimum, only local minimum; neurons were "known" by physiologists as making discrete signals (0/1), not continuous ones, and with discrete signals, there is no gradient to take. See the interview withGeoffrey Hinton,[33] who was awarded the 2024Nobel Prize in Physics for his contributions to the field.[42]

Early successes

[edit]

Contributing to the acceptance were several applications in training neural networks via backpropagation, sometimes achieving popularity outside the research circles.

In 1987,NETtalk learned to convert English text into pronunciation. Sejnowski tried training it with both backpropagation and Boltzmann machine, but found the backpropagation significantly faster, so he used it for the final NETtalk.[33]: 324  The NETtalk program became a popular success, appearing on theToday show.[43]

In 1989, Dean A. Pomerleau published ALVINN, a neural network trained todrive autonomously using backpropagation.[44]

TheLeNet was published in 1989 to recognize handwritten zip codes.

In 1992,TD-Gammon achieved top human level play in backgammon. It was a reinforcement learning agent with a neural network with two layers, trained by backpropagation.[45]

In 1993, Eric Wan won an international pattern recognition contest through backpropagation.[46][47]

After backpropagation

[edit]

During the 2000s it fell out of favour[citation needed], but returned in the 2010s, benefiting from cheap, powerfulGPU-based computing systems. This has been especially so inspeech recognition,machine vision,natural language processing, and language structure learning research (in which it has been used to explain a variety of phenomena related to first[48] and second language learning.[49])[50]

Error backpropagation has been suggested to explain human brainevent-related potential (ERP) components like theN400 andP600.[51]

In 2023, a backpropagation algorithm was implemented on aphotonic processor by a team atStanford University.[52]

See also

[edit]

Notes

[edit]
  1. ^UseC{\displaystyle C} for the loss function to allowL{\displaystyle L} to be used for the number of layers
  2. ^This followsNielsen (2015), and means (left) multiplication by the matrixWl{\displaystyle W^{l}} corresponds to converting output values of layerl1{\displaystyle l-1} to input values of layerl{\displaystyle l}: columns correspond to input coordinates, rows correspond to output coordinates.
  3. ^This section largely follows and summarizesNielsen (2015).
  4. ^The derivative of the loss function is acovector, since the loss function is ascalar-valued function of several variables.
  5. ^The activation function is applied to each node separately, so the derivative is just the diagonal matrix of the derivative on each node. This is often represented as theHadamard product with the vector of derivatives, denoted by(fl){\displaystyle (f^{l})'\odot }, which is mathematically identical but better matches the internal representation of the derivatives as a vector, rather than a diagonal matrix.
  6. ^Since matrix multiplication is linear, the derivative of multiplying by a matrix is just the matrix:(Wx)=W{\displaystyle (Wx)'=W}.
  7. ^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.
  8. ^There can be multiple output neurons, in which case the error is the squared norm of the difference vector.
  9. ^This order follows (Rumelhart, Hinton & Williams, 1986a):[8] "Δwij{\displaystyle \Delta w_{i}j} is the change to be made to the weight from thei{\displaystyle i}th to thej{\displaystyle j}th unit"

References

[edit]
  1. ^abKelley, Henry J. (1960). "Gradient theory of optimal flight paths".ARS Journal.30 (10):947–954.doi:10.2514/8.5282.
  2. ^abBryson, Arthur E. (1962). "A gradient method for optimizing multi-stage allocation processes".Proceedings of the Harvard Univ. Symposium on digital computers and their applications, 3–6 April 1961. Cambridge: Harvard University Press.OCLC 498866871.
  3. ^Goodfellow, Bengio & Courville 2016, p. 214, "This table-filling strategy is sometimes calleddynamic programming."
  4. ^Goodfellow, Bengio & Courville 2016, p. 200, "The term back-propagation is often misunderstood as meaning the whole learning algorithm for multilayer neural networks. Backpropagation refers only to the method for computing the gradient, while other algorithms, such as stochastic gradient descent, is used to perform learning using this gradient."
  5. ^abGoodfellow, Bengio & Courville (2016, p. 217–218), "The back-propagation algorithm described here is only one approach to automatic differentiation. It is a special case of a broader class of techniques calledreverse mode accumulation."
  6. ^Ramachandran, Prajit; Zoph, Barret; Le, Quoc V. (2017-10-27). "Searching for Activation Functions".arXiv:1710.05941 [cs.NE].
  7. ^Misra, Diganta (2019-08-23). "Mish: A Self Regularized Non-Monotonic Activation Function".arXiv:1908.08681 [cs.LG].
  8. ^abcRumelhart, David E.;Hinton, Geoffrey E.;Williams, Ronald J. (1986a). "Learning representations by back-propagating errors".Nature.323 (6088):533–536.Bibcode:1986Natur.323..533R.doi:10.1038/323533a0.S2CID 205001834.
  9. ^Tan, Hong Hui; Lim, King Han (2019)."Review of second-order optimization techniques in artificial neural networks backpropagation".IOP Conference Series: Materials Science and Engineering.495 (1) 012003.Bibcode:2019MS&E..495a2003T.doi:10.1088/1757-899X/495/1/012003.S2CID 208124487.
  10. ^abWiliamowski, Bogdan; Yu, Hao (June 2010)."Improved Computation for Levenberg–Marquardt Training"(PDF).IEEE Transactions on Neural Networks and Learning Systems.21 (6): 930.Bibcode:2010ITNN...21..930W.doi:10.1109/TNN.2010.2045657.
  11. ^Martens, James (August 2020). "New Insights and Perspectives on the Natural Gradient Method".Journal of Machine Learning Research (21).arXiv:1412.1193.
  12. ^Nielsen (2015), "[W]hat assumptions do we need to make about our cost function ... in order that backpropagation can be applied? The first assumption we need is that the cost function can be written as an average ... over cost functions ... for individual training examples ... The second assumption we make about the cost is that it can be written as a function of the outputs from the neural network ..."
  13. ^LeCun, Yann; Bengio, Yoshua; Hinton, Geoffrey (2015)."Deep learning"(PDF).Nature.521 (7553):436–444.Bibcode:2015Natur.521..436L.doi:10.1038/nature14539.PMID 26017442.S2CID 3074096.
  14. ^Buckland, Matt; Collins, Mark (2002).AI Techniques for Game Programming. Boston: Premier Press.ISBN 1-931841-08-X.
  15. ^Leibniz, Gottfried Wilhelm Freiherr von (1920).The Early Mathematical Manuscripts of Leibniz: Translated from the Latin Texts Published by Carl Immanuel Gerhardt with Critical and Historical Notes (Leibniz published the chain rule in a 1676 memoir). Open court publishing Company.ISBN 978-0-598-81846-1.{{cite book}}:ISBN / Date incompatibility (help)
  16. ^Rodríguez, Omar Hernández; López Fernández, Jorge M. (2010)."A Semiotic Reflection on the Didactics of the Chain Rule".The Mathematics Enthusiast.7 (2):321–332.doi:10.54870/1551-3440.1191.S2CID 29739148. Retrieved2019-08-04.
  17. ^Rosenblatt, Frank (1962).Principles of Neurodynamics. Spartan, New York. pp. 287–298.
  18. ^LeCun, Yann, et al. "A theoretical framework for back-propagation."Proceedings of the 1988 connectionist models summer school. Vol. 1. 1988.
  19. ^Hecht-Nielsen, Robert (1990).Neurocomputing. Internet Archive. Reading, Mass. : Addison-Wesley Pub. Co. pp. 124–125.ISBN 978-0-201-09355-1.
  20. ^abRobbins, H.; Monro, S. (1951)."A Stochastic Approximation Method".The Annals of Mathematical Statistics.22 (3): 400.doi:10.1214/aoms/1177729586.
  21. ^Dreyfus, Stuart (1962)."The numerical solution of variational problems".Journal of Mathematical Analysis and Applications.5 (1):30–45.doi:10.1016/0022-247x(62)90004-5.
  22. ^Dreyfus, Stuart E. (1990). "Artificial Neural Networks, Back Propagation, and the Kelley-Bryson Gradient Procedure".Journal of Guidance, Control, and Dynamics.13 (5):926–928.Bibcode:1990JGCD...13..926D.doi:10.2514/3.25422.
  23. ^Mizutani, Eiji; Dreyfus, Stuart; Nishio, Kenichi (July 2000)."On derivation of MLP backpropagation from the Kelley-Bryson optimal-control gradient formula and its application"(PDF). Proceedings of the IEEE International Joint Conference on Neural Networks.
  24. ^Dreyfus, Stuart (1973). "The computational solution of optimal control problems with time lag".IEEE Transactions on Automatic Control.18 (4):383–385.doi:10.1109/tac.1973.1100330.
  25. ^abSchmidhuber, Jürgen (2022). "Annotated History of Modern AI and Deep Learning".arXiv:2212.11279 [cs.NE].
  26. ^Amari, Shun'ichi (1967). "A theory of adaptive pattern classifier".IEEE Transactions.EC (16):279–307.
  27. ^Linnainmaa, Seppo (1970).The representation of the cumulative rounding error of an algorithm as a Taylor expansion of the local rounding errors (Masters) (in Finnish). University of Helsinki. pp. 6–7.
  28. ^Linnainmaa, Seppo (1976). "Taylor expansion of the accumulated rounding error".BIT Numerical Mathematics.16 (2):146–160.doi:10.1007/bf01931367.S2CID 122357351.
  29. ^Griewank, Andreas (2012). "Who Invented the Reverse Mode of Differentiation?".Optimization Stories. Documenta Mathematica, Extra Volume ISMP. pp. 389–400.S2CID 15568746.
  30. ^Griewank, Andreas;Walther, Andrea (2008).Evaluating Derivatives: Principles and Techniques of Algorithmic Differentiation, Second Edition. SIAM.ISBN 978-0-89871-776-1.
  31. ^Werbos, Paul (1982)."Applications of advances in nonlinear sensitivity analysis"(PDF).System modeling and optimization. Springer. pp. 762–770.Archived(PDF) from the original on 14 April 2016. Retrieved2 July 2017.
  32. ^Werbos, Paul J. (1994).The Roots of Backpropagation: From Ordered Derivatives to Neural Networks and Political Forecasting. New York: John Wiley & Sons.ISBN 0-471-59897-6.
  33. ^abcdAnderson, James A.; Rosenfeld, Edward, eds. (2000).Talking Nets: An Oral History of Neural Networks. The MIT Press.doi:10.7551/mitpress/6626.003.0016.ISBN 978-0-262-26715-1.
  34. ^P. J. Werbos, "Backpropagation through time: what it does and how to do it," in Proceedings of the IEEE, vol. 78, no. 10, pp. 1550–1560, Oct. 1990,doi:10.1109/5.58337
  35. ^Olazaran Rodriguez, Jose Miguel.A historical sociology of neural network research. PhD Dissertation. University of Edinburgh, 1991.
  36. ^Rumelhart; Hinton; Williams (1986)."Learning representations by back-propagating errors"(PDF).Nature.323 (6088):533–536.Bibcode:1986Natur.323..533R.doi:10.1038/323533a0.S2CID 205001834.
  37. ^Rumelhart, David E.;Hinton, Geoffrey E.;Williams, Ronald J. (1986b)."8. Learning Internal Representations by Error Propagation". InRumelhart, David E.;McClelland, James L. (eds.).Parallel Distributed Processing: Explorations in the Microstructure of Cognition. Vol. 1 : Foundations. Cambridge: MIT Press.ISBN 0-262-18120-7.
  38. ^Alpaydin, Ethem (2010).Introduction to Machine Learning. MIT Press.ISBN 978-0-262-01243-0.
  39. ^Parker, D.B. (1985). Learning Logic: Casting the Cortex of the Human Brain in Silicon. Center for Computational Research in Economics and Management Science (Report). Cambridge MA: Massachusetts Institute of Technology. Technical Report TR-47.
  40. ^Hertz, John (1991).Introduction to the theory of neural computation. Krogh, Anders., Palmer, Richard G. Redwood City, Calif.: Addison-Wesley. p. 8.ISBN 0-201-50395-6.OCLC 21522159.
  41. ^Le Cun, Yann (1987).Modèles connexionnistes de l'apprentissage (Thèse de doctorat d'état thesis). Paris, France: Université Pierre et Marie Curie.
  42. ^"The Nobel Prize in Physics 2024".NobelPrize.org. Retrieved2024-10-13.
  43. ^Sejnowski, Terrence J. (2018).The deep learning revolution. Cambridge, Massachusetts London, England: The MIT Press.ISBN 978-0-262-03803-4.
  44. ^Pomerleau, Dean A. (1988)."ALVINN: An Autonomous Land Vehicle in a Neural Network".Advances in Neural Information Processing Systems.1. Morgan-Kaufmann.
  45. ^Sutton, Richard S.; Barto, Andrew G. (2018)."11.1 TD-Gammon".Reinforcement Learning: An Introduction (2nd ed.). Cambridge, MA: MIT Press.
  46. ^Schmidhuber, Jürgen (2015). "Deep learning in neural networks: An overview".Neural Networks.61:85–117.arXiv:1404.7828.doi:10.1016/j.neunet.2014.09.003.PMID 25462637.S2CID 11715509.
  47. ^Wan, Eric A. (1994). "Time Series Prediction by Using a Connectionist Network with Internal Delay Lines". InWeigend, Andreas S.;Gershenfeld, Neil A. (eds.).Time Series Prediction: Forecasting the Future and Understanding the Past. Proceedings of the NATO Advanced Research Workshop on Comparative Time Series Analysis. Vol. 15. Reading: Addison-Wesley. pp. 195–217.ISBN 0-201-62601-2.S2CID 12652643.
  48. ^Chang, Franklin; Dell, Gary S.; Bock, Kathryn (2006). "Becoming syntactic".Psychological Review.113 (2):234–272.doi:10.1037/0033-295x.113.2.234.PMID 16637761.
  49. ^Janciauskas, Marius; Chang, Franklin (2018)."Input and Age-Dependent Variation in Second Language Learning: A Connectionist Account".Cognitive Science.42 (Suppl Suppl 2):519–554.doi:10.1111/cogs.12519.PMC 6001481.PMID 28744901.
  50. ^"Decoding the Power of Backpropagation: A Deep Dive into Advanced Neural Network Techniques".janbasktraining.com. 30 January 2024.
  51. ^Fitz, Hartmut; Chang, Franklin (2019). "Language ERPs reflect learning through prediction error propagation".Cognitive Psychology.111:15–52.doi:10.1016/j.cogpsych.2019.03.002.hdl:21.11116/0000-0003-474D-8.PMID 30921626.S2CID 85501792.
  52. ^"Photonic Chips Curb AI Training's Energy Appetite - IEEE Spectrum".IEEE. Retrieved2023-05-25.

Further reading

[edit]

External links

[edit]
Concepts
Applications
Implementations
Audio–visual
Text
Decisional
People
Architectures
Political
Social and economic
National
Other
Retrieved from "https://en.wikipedia.org/w/index.php?title=Backpropagation&oldid=1328447875"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp