Skip to main content
SingaporeComputer ScienceSyllabus dot point

How does a neural network learn, and what makes deep learning powerful for tasks like image recognition?

Describe an artificial neural network in terms of neurons, weights and layers, and explain how training adjusts weights

A focused answer to the H2 Computing outcome on neural networks. Artificial neurons with weighted inputs and an activation function, input, hidden and output layers, how training adjusts weights to reduce error, and what deep learning adds.

Generated by Claude Opus 4.88 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. The answer
  3. Examples in context
  4. Try this

What this dot point is asking

SEAB wants you to describe an artificial neural network in terms of neurons, weights and layers, and explain how training adjusts the weights to improve predictions. The central idea is that a neural network is built from simple units that each compute a weighted sum and apply an activation function, and that learning is nothing more than gradually adjusting the weights to reduce the network's error.

The answer

The artificial neuron

The building block is an artificial neuron. It takes several inputs xix_i, each with a weight wiw_i, computes a weighted sum, adds a bias bb, and applies an activation function ff:

output=f ⁣(iwixi+b)\text{output} = f\!\left(\sum_i w_i x_i + b\right)

The activation function (a step, sigmoid or similar) introduces non-linearity, which lets a network of neurons model complex, non-linear relationships rather than just straight-line ones.

Layers

Neurons are organised into layers:

  • Input layer - one neuron per input feature; it receives the raw data.
  • Hidden layer(s) - between input and output; they transform the data, each neuron combining the previous layer's outputs.
  • Output layer - produces the final prediction (a class or a value).

In a feedforward network, data flows from input through hidden layers to output, with each layer's outputs feeding the next.

The role of the weights

The weights are the network's adjustable parameters. Each weight sets the strength and importance of one connection - how much an input influences a neuron. The pattern of weights is what the network "knows"; finding good weights is the whole goal of learning.

How training adjusts the weights

Training is an iterative loop over the training data:

  1. The network makes a prediction for a training example.
  2. The prediction is compared with the known correct answer to compute an error (loss).
  3. The weights are adjusted to reduce that error - nudged in the direction that makes the next prediction closer to correct, with the adjustment propagated back through the layers.
  4. Repeat over many examples and passes; the error gradually falls as the weights improve.

Over time the network learns the patterns in the data, encoded entirely in its weights.

Deep learning

Deep learning uses neural networks with many hidden layers (deep networks). Each layer can learn increasingly abstract features automatically from raw data - early layers detect edges, later layers detect shapes, then objects. This makes deep learning excel at perception tasks such as image recognition, speech recognition and natural language processing, given large datasets and computing power.

Examples in context

Example 1. Face recognition on a phone. A deep network unlocking a phone learns, layer by layer, from edges to facial features to a whole-face representation, all from labelled face images. No engineer hand-codes "what a nose looks like" - the weights capture it through training, which is why deep learning replaced older hand-engineered approaches.

Example 2. Why deep learning needs lots of data and compute. Each weight is tuned from data, and deep networks have millions of weights, so they need large labelled datasets and significant computing power to train. This explains why deep learning surged alongside big datasets and powerful hardware, rather than decades earlier when the core ideas already existed.

Try this

Q1. Name the three kinds of layer in a feedforward neural network. [1 mark]

  • Cue. Input layer, hidden layer(s), output layer.

Q2. How does a single neuron compute its output? [2 marks]

  • Cue. It computes a weighted sum of its inputs plus a bias, then applies an activation function: f(wixi+b)f(\sum w_i x_i + b).

Q3. In one sentence, how is a neural network trained? [2 marks]

  • Cue. It repeatedly predicts, measures the error against the known answer, and adjusts the weights to reduce that error over many examples.

Exam-style practice questions

Practice questions written in the style of SEAB exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

Original6 marks(a) Describe the structure of a simple feedforward artificial neural network, naming the three kinds of layer. (b) Explain how a single artificial neuron computes its output from its inputs. (c) What is the role of the weights?
Show worked answer →

(a) A feedforward neural network has an input layer (one neuron per input feature), one or more hidden layers (which transform the data), and an output layer (giving the prediction). Neurons in one layer connect to neurons in the next.

(b) A neuron computes a weighted sum of its inputs (each input multiplied by its connection weight), adds a bias, then applies an activation function to produce its output:

textoutput=f!left(sumiwixi+bright)\\text{output} = f\\!\\left(\\sum_i w_i x_i + b\\right)

The activation function (such as a step or sigmoid) introduces non-linearity, letting the network model complex relationships.

(c) The weights determine the strength and importance of each connection - how much each input influences a neuron's output. Learning the right weights is how the network captures patterns; training adjusts them to improve predictions.

Markers reward the input/hidden/output layers, the neuron's weighted sum plus bias through an activation function, and weights as the learnable strengths of connections.

Original5 marks(a) Explain, in outline, how a neural network is trained to make better predictions. (b) State what is meant by deep learning and give one type of task at which it excels.
Show worked answer →

(a) Training is iterative. The network makes a prediction on training data; the prediction is compared with the known correct answer to compute an error (loss). The error is used to adjust the weights so the next prediction is closer to correct (the weights are nudged in the direction that reduces the error, propagating the adjustment back through the layers). Repeating this over many examples and passes gradually reduces the error, so the network learns the patterns in the data.

(b) Deep learning uses neural networks with many hidden layers (deep networks), which can learn increasingly abstract features at each layer automatically from raw data. It excels at tasks such as image recognition, speech recognition and natural language processing, where hand-engineering features is impractical and large datasets are available.

Markers reward the predict-measure-error-adjust-weights iterative loop reducing error, and deep learning as many-layered networks excelling at perception tasks like image or speech recognition.

Related dot points