University of Sydney · FACULTY OF MACHINE LEARNING

COMP4318 · Machine Learning and Data Mining

- one subject, every graph, every model, every mark
Machine Learning14 Chapters12-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 7 of 11 · COMP4318

Neural Networks: Perceptrons & Backpropagation

Week 7 builds neural networks from the perceptron up: activation functions, the multi-layer perceptron, gradient descent and the backpropagation algorithm that trains the weights. The exam typically asks a small MLP forward pass with sigmoids, or to name activation functions from their plots and say which suits a CNN and why. The homework quiz (h7) drills the forward pass and the update rule.

In this chapter

What this chapter covers

  • 01Neuron output a = f(w·x + b), where f is the activation/transfer function
  • 02Perceptron: step activation, binary output; learning rule e = t − a, w ← w + e·x, b ← b + e
  • 03Perceptron limits: solves AND/OR/NAND but NOT XOR (needs a 2-layer net); converges iff data are linearly separable
  • 04Multi-layer perceptron: feedforward, fully connected, differentiable activation (sigmoid f(z) = 1/(1+e^(−z)))
  • 05Sigmoid derivative f'(x) = f(x)(1 − f(x)); the vanishing-gradient problem; ReLU y = max(0, x) as a fix
  • 06Backpropagation: forward pass, then propagate error backward by gradient descent; Δw = η·δ·o
  • 07Output-neuron δ = (t − o)·o·(1 − o); hidden-neuron δ = o(1 − o)·Σ w·δ (for a sigmoid)
  • 08Gradient-descent variants: batch, stochastic (SGD) and mini-batch; the learning rate η as a hyperparameter
Worked example · free

A forward pass through a small sigmoid network

Q [4 marks]. A network has one hidden unit and one output unit, all sigmoid activations σ(z) = 1/(1 + e^(−z)). Inputs x1 = 1, x2 = 2. The hidden unit has weights w1 = 0.5, w2 = 0.5 and bias −1; the output unit takes the hidden activation with weight 1 and bias 0. Compute the network's output. (4 marks)
  • +1Hidden pre-activation: z_h = w1·x1 + w2·x2 + b_h = 0.5·1 + 0.5·2 − 1 = 0.5.
  • +1Hidden activation: o_h = σ(0.5) = 1/(1 + e^(−0.5)) = 0.622.
  • +1Output pre-activation: z_o = w·o_h + b_o = 1·0.622 + 0 = 0.622.
  • +1Output activation: o = σ(0.622) = 1/(1 + e^(−0.622)) = 0.651.
The network output is approximately 0.651 (hidden activation 0.622).
Sia tip — Do the forward pass strictly layer by layer, applying the activation after each weighted sum. In backpropagation the error then flows backward with δ_output = (t − o)·o·(1 − o) for a sigmoid — that o(1 − o) factor is the sigmoid's own derivative, and it is what makes deep sigmoid nets suffer vanishing gradients.
Glossary

Key terms

Perceptron
The simplest neural unit: a step activation on w·x + b giving a binary output; trained by e = t − a, w ← w + e·x. Converges only if the data are linearly separable and cannot learn XOR.
Activation function
The non-linear function f applied to a neuron's weighted sum; examples are step, sigmoid, tanh and ReLU.
Sigmoid
f(z) = 1/(1 + e^(−z)), a smooth (0,1) squashing function with derivative f'(z) = f(z)(1 − f(z)); the classic differentiable activation for MLPs.
Backpropagation
Training by a forward pass then a backward pass that propagates the error using gradient descent; weight update Δw = η·δ·o with output δ = (t−o)·o(1−o).
Gradient descent (SGD)
Iteratively updating weights against the loss gradient; batch uses all examples, stochastic (SGD) updates per example, mini-batch uses small groups.
Learning rate η
The step-size hyperparameter of gradient descent; too small learns slowly, too large oscillates or diverges.
FAQ

Neural Networks: Perceptrons & Backpropagation FAQ

Why can't a single perceptron learn XOR?

Because a perceptron draws a single straight decision boundary, and XOR is not linearly separable — no straight line separates its two classes. It can learn AND, OR and NAND, which are linearly separable, but XOR needs a two-layer network (a hidden layer) to bend the boundary.

What's the difference between batch, mini-batch and stochastic gradient descent?

They differ in how many examples contribute to each weight update. Batch gradient descent sums the error over all examples then updates once per pass (smooth but slow). Stochastic gradient descent updates after every single example (noisy, zig-zag, but fast and can escape shallow minima). Mini-batch updates on small groups — the common compromise.

What is the vanishing-gradient problem?

In a deep network trained with sigmoids, the backpropagated error is repeatedly multiplied by the sigmoid derivative o(1−o), which is at most 0.25 and near 0 when the neuron saturates. Multiplying many such factors shrinks the gradient toward zero, so the earliest layers learn extremely slowly. ReLU (y = max(0,x)), which has gradient 1 for positive inputs, mitigates it.

How is the neural-network question examined?

Commonly as a small forward pass — compute each layer's weighted sum, apply the sigmoid, propagate to the output — and as a conceptual part naming activation functions from plots and saying which suits a CNN (ReLU) and why. Show every pre-activation and activation to earn the method marks.

Study strategy

Exam move

Rehearse the forward pass until it is mechanical: for each neuron compute w·x + b, apply the activation, feed forward. Memorise the sigmoid and its derivative f'(x) = f(x)(1 − f(x)), and the backprop deltas — output δ = (t − o)·o(1 − o) and hidden δ = o(1 − o)·Σwδ. Be ready to explain the perceptron's XOR limitation, the batch/mini-batch/SGD distinction, and the vanishing-gradient problem with ReLU as the fix. When the arithmetic of a forward pass slips, ask Sia to recompute it with fresh weights and check each activation.

Working through Neural Networks: Perceptrons & Backpropagation in COMP4318? Sia is AskSia’s AI Machine Learning tutor — ask any COMP4318 Neural Networks: Perceptrons & Backpropagation question and get a clear, step-by-step explanation grounded in how COMP4318 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.

A+Everything unlocked
Unlocks this Bible + all 12 of your University of Sydney subjects - and 1,000+ Bibles across every Australian university.
Sia - your COMP4318 tutor, unlimited, worked the way the exam marks it
The full 12-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$25/ month
30-day money-back · cancel in one tap · how it works
Unlock the full COMP4318 Bible + 12 University of Sydney subjects解锁完整 COMP4318 Bible + University of Sydney 12 门科目
$25/mo