Delta rule

From HandWiki
Short description: Gradient descent learning rule in machine learning

In machine learning, the delta rule is a gradient descent learning rule for updating the weights of the inputs to artificial neurons in a single-layer neural network.[1] It can be derived as the backpropagation algorithm for a single-layer neural network with mean-square error loss function.

For a neuron [math]\displaystyle{ j }[/math] with activation function [math]\displaystyle{ g(x) }[/math], the delta rule for neuron [math]\displaystyle{ j }[/math]'s [math]\displaystyle{ i }[/math]-th weight [math]\displaystyle{ w_{ji} }[/math] is given by

[math]\displaystyle{ \Delta w_{ji} = \alpha(t_j-y_j) g'(h_j) x_i , }[/math]

where

  • [math]\displaystyle{ \alpha }[/math] is a small constant called learning rate
  • [math]\displaystyle{ g(x) }[/math] is the neuron's activation function
  • [math]\displaystyle{ g' }[/math] is the derivative of [math]\displaystyle{ g }[/math]
  • [math]\displaystyle{ t_j }[/math] is the target output
  • [math]\displaystyle{ h_j }[/math] is the weighted sum of the neuron's inputs
  • [math]\displaystyle{ y_j }[/math] is the actual output
  • [math]\displaystyle{ x_i }[/math] is the [math]\displaystyle{ i }[/math]-th input.

It holds that [math]\displaystyle{ h_j = \sum_i x_i w_{ji} }[/math] and [math]\displaystyle{ y_j=g(h_j) }[/math].

The delta rule is commonly stated in simplified form for a neuron with a linear activation function as [math]\displaystyle{ \Delta w_{ji} = \alpha \left(t_j-y_j\right) x_i }[/math]

While the delta rule is similar to the perceptron's update rule, the derivation is different. The perceptron uses the Heaviside step function as the activation function [math]\displaystyle{ g(h) }[/math], and that means that [math]\displaystyle{ g'(h) }[/math] does not exist at zero, and is equal to zero elsewhere, which makes the direct application of the delta rule impossible.

Derivation of the delta rule

The delta rule is derived by attempting to minimize the error in the output of the neural network through gradient descent. The error for a neural network with [math]\displaystyle{ j }[/math] outputs can be measured as [math]\displaystyle{ E = \sum_{j} \tfrac{1}{2} \left(t_j-y_j\right)^2 . }[/math]

In this case, we wish to move through "weight space" of the neuron (the space of all possible values of all of the neuron's weights) in proportion to the gradient of the error function with respect to each weight. In order to do that, we calculate the partial derivative of the error with respect to each weight. For the [math]\displaystyle{ i }[/math]th weight, this derivative can be written as [math]\displaystyle{ \frac{\partial E}{ \partial w_{ji} } . }[/math]

Because we are only concerning ourselves with the [math]\displaystyle{ j }[/math]-th neuron, we can substitute the error formula above while omitting the summation: [math]\displaystyle{ \frac{\partial E}{ \partial w_{ji} } = \frac{ \partial }{ \partial w_{ji} } \left [\frac{1}{2} \left( t_j-y_j \right ) ^2 \right ] }[/math]

Next we use the chain rule to split this into two derivatives: [math]\displaystyle{ \frac{\partial E}{\partial w_{ji}} = \frac{ \partial \left ( \frac{1}{2} \left( t_j-y_j \right ) ^2 \right ) }{ \partial y_j } \frac{ \partial y_j }{ \partial w_{ji} } }[/math]

To find the left derivative, we simply apply the power rule and the chain rule: [math]\displaystyle{ \frac{\partial E}{\partial w_{ji}} = - \left ( t_j-y_j \right ) \frac{ \partial y_j }{ \partial w_{ji} } }[/math]

To find the right derivative, we again apply the chain rule, this time differentiating with respect to the total input to [math]\displaystyle{ j }[/math], [math]\displaystyle{ h_j }[/math]: [math]\displaystyle{ \frac{\partial E}{\partial w_{ji}} = - \left ( t_j-y_j \right ) \frac{ \partial y_j }{ \partial h_j } \frac{ \partial h_j }{ \partial w_{ji} } }[/math]

Note that the output of the [math]\displaystyle{ j }[/math]th neuron, [math]\displaystyle{ y_j }[/math], is just the neuron's activation function [math]\displaystyle{ g }[/math] applied to the neuron's input [math]\displaystyle{ h_j }[/math]. We can therefore write the derivative of [math]\displaystyle{ y_j }[/math] with respect to [math]\displaystyle{ h_j }[/math] simply as [math]\displaystyle{ g }[/math]'s first derivative: [math]\displaystyle{ \frac{\partial E}{\partial w_{ji}} = - \left ( t_j-y_j \right ) g'(h_j) \frac{ \partial h_j }{ \partial w_{ji} } }[/math]

Next we rewrite [math]\displaystyle{ h_j }[/math] in the last term as the sum over all [math]\displaystyle{ k }[/math] weights of each weight [math]\displaystyle{ w_{jk} }[/math] times its corresponding input [math]\displaystyle{ x_k }[/math]: [math]\displaystyle{ \frac{\partial E}{\partial w_{ji}} = - \left ( t_j-y_j \right ) g'(h_j) \; \frac{ \partial}{ \partial w_{ji} } \!\!\left[ \sum_{i} x_i w_{ji} \right] }[/math]

Because we are only concerned with the [math]\displaystyle{ i }[/math]th weight, the only term of the summation that is relevant is [math]\displaystyle{ x_i w_{ji} }[/math]. Clearly, [math]\displaystyle{ \frac{ \partial (x_i w_{ji}) }{ \partial w_{ji} } = x_i. }[/math] giving us our final equation for the gradient: [math]\displaystyle{ \frac{\partial E}{ \partial w_{ji} } = - \left ( t_j-y_j \right ) g'(h_j) x_i }[/math]

As noted above, gradient descent tells us that our change for each weight should be proportional to the gradient. Choosing a proportionality constant [math]\displaystyle{ \alpha }[/math] and eliminating the minus sign to enable us to move the weight in the negative direction of the gradient to minimize error, we arrive at our target equation: [math]\displaystyle{ \Delta w_{ji}=\alpha(t_j-y_j) g'(h_j) x_i . }[/math]

See also

References

  1. Russell, Ingrid. "The Delta Rule". University of Hartford. Archived from the original on 4 March 2016. https://web.archive.org/web/20160304032228/http://uhavax.hartford.edu/compsci/neural-networks-delta-rule.html. Retrieved 5 November 2012.