Chapter 9

Perceptrons and feed-forward networks

A network alternates affine transformations with activations. Forward evaluation computes predictions; reverse differentiation computes parameter gradients. Write the value at every node before differentiating a small exam network.

9.1 Linear threshold perceptron

Past papers · DA 2024–2026 (3 papers): 1 question, 1 mark

A single perceptron uses f(x)=w⊤x+bf(\mathbf x)=\mathbf w^\top\mathbf x+b and labels y∈{−1,+1}y\in\{-1,+1\}. Follow the question's convention at f=0f=0; some algorithms update on every nonpositive signed score, while others update only on a misclassification.

An update increases that observation's signed score but need not classify it correctly immediately. It may spoil another observation. On a finite strictly separable dataset, the standard mistake-driven perceptron converges after finitely many updates. This is not guaranteed for nonseparable data; a single affine threshold cannot represent XOR.

For the standard update on yf≤0y f\le0, augment the input by 11 for bias. If the augmented vectors have norms at most RR, and a unit separating vector gives signed scores at least γ>0\gamma>0, zero initial weights and a fixed positive step give at most (R/γ)2(R/\gamma)^2 updates. The bound concerns the augmented space and is usually loose.

9.2 Layer values, activations and parameter counts

Past papers · DA 2024–2026 (3 papers): 3 questions, 6 marks

Let the network have widths d0,d1,…,dLd_0,d_1,\ldots,d_L, where d0d_0 is the input width and dLd_L the output width. Layer ℓ\ell has matrix W(ℓ)\mathbf W^{(\ell)} of shape dℓ×dℓ−1d_\ell\times d_{\ell-1} and bias b(ℓ)∈Rdℓ\mathbf b^{(\ell)}\in\mathbb R^{d_\ell}.

ReLU is continuous everywhere and positively homogeneous: ReLU(az)=aReLU(z)\mathrm{ReLU}(az)=a\mathrm{ReLU}(z) for a≥0a\ge0. It is not invariant under scaling. On a fixed activation pattern, a ReLU network is affine: replace each active ReLU by identity and each inactive one by zero. Only collapse all layers to a single affine map where that pattern remains valid. A network containing only affine layers is globally affine regardless of depth. Nonlinear hidden activations allow nonlinear boundaries, including XOR.

Use an identity output for unrestricted numerical regression, sigmoid for a binary probability, and softmax for mutually exclusive multiclass probabilities. A sigmoid at each output instead permits multiple independent binary labels.

9.3 Backpropagation and gradient updates

Past papers · DA 2024–2026 (3 papers): 2 questions, 3 marks

Use the layer symbols from Section 9.2 and a differentiable per-observation loss ℓ\ell. Let δ(ℓ)=∂ℓ/∂z(ℓ)\boldsymbol\delta^{(\ell)}=\partial\ell/\partial\mathbf z^{(\ell)}. Work away from activation kinks unless a subgradient convention is supplied.

Use pre-update weights throughout one backward pass. For an output derivative rather than a loss derivative, start the reverse pass with derivative one at that output. Every directed path contributes a product of local derivatives; contributions from multiple paths add. An inactive ReLU blocks derivatives through that path.

Last-minute recall

  • A perceptron update improves the updated point's signed score.
  • Biases are counted once per non-input neuron.
  • ReLU has no ordinary derivative at zero.
  • Affine layers without nonlinear activations collapse to one affine map.
  • Softmax is invariant to a common score shift.
  • Backpropagation is the chain rule with path contributions added.
  • Gradient descent subtracts the gradient of the stated objective.

Revise offline: the whole Machine Learning handbook as one PDF

42 pages · 1.8 MBFree to read online. Sign in to download the PDF.We save the handbook, version and request time in My downloads. Privacy policy

All chapters · Corrections