Friday, 10 January 2020

Feedforward and Backpropagation in DNN


x1, x2, x3 = Input values
D          = Dot product of inputs and weights (forward)
H          = Output value of a neuron
d1, d2     = Differences compared to expected values = abs(out-y)
L          = Summarised loss = d1+d2
G          = Gradient of loss function
D2         = Dot product of gradients and weights (backward)
activate   = Activation function
dActivate  = Derivative of activation function
B          = Backpropagation intermediate value at a neuron

Gradient of loss with respect to W:
Gw = B * Input_to_the_Weight

Apply gradient:
W -= Learning_Rate * Gw

First layer outputs:  H1, H2, H3 (from top down)
Second layer outputs: H4, H5 (from top down)

Gradient for last layer
Last layer is not the same, for hidden layer: Gw is like above.
For the last layer (let L = Mean squared error):
Gw = dL/dw = dMSE/dw = dMSE/dAct * dAct/dDot * dDot/dw

No comments:

Post a Comment