Assuming a single perceptron (see figure), I have found two versions of how to use backpropagation to update the weights. The perceptron is split in two, so we see the weighted sum on the left (the output of this is net) and then the sigmoid function phi on the right (the output of this is out).

enter image description here

So for the backpropagation portion, we compute $\frac{\delta cost}{\delta w}=\frac{\delta cost}{\delta out}\times \frac{\delta out}{\delta net} \times \frac{\delta net}{\delta w}​$, to find how the weight affects the error.

For the portion $\frac{\delta out}{\delta net}$ I have seen three different versions for how to compute the value:

  1. $\frac{\delta out}{\delta net}$ = $\phi'(out) = \phi(out) \times (1 - \phi(out))$
  2. $\frac{\delta out}{\delta net}$ = $\phi'(net)= \phi(net) \times (1 - \phi(net))$
  3. $\frac{\delta out}{\delta net}$ = $out \times (1 - out)$

Can somebody explain to me which one is correct and why? Or is there one which should be preferred?

  • 1
    $\begingroup$ Could you provide sources for the three different versions you have seen? $\endgroup$ Commented Jan 20, 2023 at 15:41
  • $\begingroup$ For 1. mattmazur.com/2015/03/17/a-step-by-step-backpropagation-example, for 2. towardsdatascience.com/… and for 3. ai.stackexchange.com/questions/5638/… $\endgroup$
    – HTH
    Commented Jan 22, 2023 at 12:34
  • $\begingroup$ Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. $\endgroup$
    – Community Bot
    Commented Jan 25, 2023 at 19:48
  • $\begingroup$ If I'm understanding you, you have some input "x" and the output "out", but it's not clear to me what equations you are using to go from x to out. Are those the \sigma and \phi functions? $\endgroup$
    – Taw
    Commented Jan 25, 2023 at 19:49

1 Answer 1

  1. is always wrong. Most implementations then "silently" correct this error, even if the docstrings have this wrong variant, in the actual use it is done correctly.

  2. and 3. are the same, considering that $out=\phi(net)$. 3. is more economic if the activation is a solution of an autonomous ODE like with the logistic function. 2. is more generally true, especially if the activation function gets modified/perturbed by some linear function to avoid random behavior in the flat parts of the sigmoid at large values.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .