Memra

Backpropagation in multilayer networks

◈ 5 cards

The exam Q9 answer: forward pass → output error → chain-rule blame to hidden weights → gradient-descent update; sigmoid f’ = f(1−f); solves XOR.

Why we need a differentiable neuron

The perceptron’s hard has no usable gradient — the output jumps from to with no sense of how wrong it is. Replace it with the smooth sigmoid (logistic) activation

The derivative is computable from the output alone, which is exactly what makes gradient descent practical. With a hidden layer in between, the network can carve the curved boundaries that a single perceptron cannot — it can solve XOR.

Backpropagation — the exam Q9 answer

Backprop trains a multilayer net by descending the squared-error surface. One pattern, four steps:

  1. Forward pass. Feed the input forward; each layer computes , layer by layer, to the output.
  2. Output error. Compare output with the target . The output-node delta is
  3. the error scaled by the sigmoid slope .
  4. Backward pass — assign blame by the chain rule. A hidden node has no target of its own. Its responsibility is the weighted sum of the deltas of the output nodes it feeds, scaled by its own slope:
  5. That is the error propagated backward across the weights — the move that names the algorithm.
  6. Update every weight by gradient descent, output and hidden alike:

Repeat over the training set for many epochs; the error falls toward a (local) minimum. The exercise trains a 2-2-1 sigmoid net on XOR and prints the error dropping to ~0 with final outputs ≈ .

wwx₁x₂h₁sigmoidh₂sigmoidOhas a target dBlame travels back along these same weights: δₕ = Oₕ(1−Oₕ)·Σ δⱼwₕⱼ.
The net the exercise trains. Every hidden unit feeds the output, so on the backward pass every hidden unit is partly to blame for the output’s error — the share it receives is δ scaled by the weight on that very connection. Note that no hidden unit has a target of its own; the layer exists only to build intermediate features, which is what makes the recombined XOR problem separable.
comparechaindescendforwardO = f(Σwx)output δ(d−O)·O(1−O)hidden δO(1−O)·ΣδⱼwupdateΔw = c·δ·x
The exam Q9 answer as a pipeline. Only step 3 is peculiar to backprop: a hidden unit has no target, so its error is manufactured from the deltas of the units it feeds, scaled by its own sigmoid slope. Steps 1, 2 and 4 are ordinary gradient descent. Repeat the whole cycle for every pattern, for many epochs.
NORMAL ~/memra/learn/comp-456/backpropagation-multilayer-networks utf-8 LF