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.

🔢Inputsnumbers in⚖️Weightsmultiply➕Add up+ bias📈Activatione.g. ReLU🔁Many layers🎯Outputprediction
Every neuron does the same small job; stacking thousands of them learns complex patterns.

A simple neural network

How it works, step by step

  1. Feed an example into the input layer.
  2. Each neuron multiplies its inputs by their weights, adds them up, and passes the result on through an activation function.
  3. The output layer gives a prediction.
  4. Compare the prediction with the right answer to measure the error (the loss).
  5. 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 min

Play with a network in your browser

  1. Open the free TensorFlow Playground.
  2. Press play with the default settings and watch it learn.
  3. 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.

Build it for real · guided projectTeach a neural network to read handwritingAbout 60 min · Copy-paste code · step by step
Test what you learned

Take a quick quiz, or look up any word in the glossary.