Neural networks as a machine learning algorithm
Supervised, unsupervised & reinforcement A neural network is a flexible algorithm made of layers of connected neurons. Each connection has a weight. Data flows forward through the layers to make a prediction; the error is then sent backwards (backpropagation) to adjust the weights. With many layers it becomes deep learning, which powers image recognition, speech and LLMs.
Everyday analogy
A group of friends judging a photo: one spots whiskers, one spots ears, one spots a tail. Each passes their opinion on, and training teaches the group whose opinion to trust more.
Example
Used for: face and image recognition, speech-to-text, translation, chatbots like ChatGPT, medical image analysis. See also the Neural networks and Transformer lessons.
A simple neural network
How it works, step by step
- Feed an example into the input layer.
- Each neuron multiplies its inputs by their weights, adds them up, and passes the result on through an activation function.
- The output layer gives a prediction.
- Compare the prediction with the right answer to measure the error (the loss).
- Send the error backwards and nudge every weight to reduce it. Repeat for millions of examples.
Worked example
To read handwritten digits, the input layer takes the 784 pixels of a 28 × 28 image. Hidden layers learn strokes, loops and corners. The output layer has 10 neurons, one for each digit 0 to 9; the one with the highest score is the answer.
✓ Good for
- Learns extremely complex patterns
- The best choice for images, sound and language
- Improves with more data and computing power
⚠ Watch out for
- Needs lots of data and computing power
- Hard to explain why it gave an answer (a "black box")
- Easy to overfit without care
Try it yourself
About 15 minPlay with a network in your browser
- Open the free TensorFlow Playground.
- Press play with the default settings and watch it learn.
- Add or remove neurons and layers and see how the result changes.
What you should see: You can see a neural network learning a pattern in real time.
Use any free AI chatbot (ChatGPT, Claude, Gemini or Copilot). Never paste private or confidential information.