Machine learning explained: how computers learn from examples
What machine learning is, the three main ways machines learn, real examples you use every day, and why data matters more than anything else.
First published · AI Digested
Machine learning is a way of building software where the computer learns from examples instead of following rules a programmer wrote. It's the engine behind almost all modern AI.
A simple example: house prices
Suppose you want a program that estimates house prices. The traditional approach would be to write rules: start at £100,000, add £2,000 per square metre, add £15,000 per bedroom, adjust for the area… You would never get the rules quite right.
The machine learning approach: collect thousands of past sales, with details like size, bedrooms, location and age, and the price each one sold for. Feed them to a learning algorithm. It finds the relationship between the details and the price by itself. Then you can give it a house it has never seen and get a sensible estimate.
The result, the thing that makes predictions, is called a model.
How the learning actually happens
Almost every machine learning system follows the same loop:
- Guess. The model makes a prediction, badly at first.
- Measure. Compare the prediction with the right answer to see how wrong it was.
- Adjust. Tweak the model's internal numbers slightly to make it less wrong.
- Repeat, thousands or billions of times.
Over time the errors shrink. When the model performs well on examples it has never seen before, it's ready to use.
The three main styles of learning
Supervised learning: learning with the answers
The model is trained on examples that come with the right answer, called labels. Photos labelled "cat" or "dog". Emails labelled "spam" or "not spam". Scans labelled by doctors as showing a disease or not. Most practical machine learning is supervised.
Unsupervised learning: finding patterns alone
There are no labels. The model looks for structure by itself, for example grouping customers with similar shopping habits, or spotting a transaction that looks unlike all the others, which might be fraud.
Reinforcement learning: trial and error
The model takes actions and receives rewards or penalties, like training a dog with treats. DeepMind's AlphaGo learned to play Go this way, partly by playing millions of games against itself. Reinforcement learning is also used to fine-tune chatbots, with people's preferences acting as the reward.
Machine learning you use every day
- Spam filters learn from emails people mark as junk.
- Recommendations on Netflix, Spotify, Amazon and YouTube learn from what you and similar people watched, played or bought.
- Fraud detection at your bank learns what normal spending looks like for you.
- Predictive text on your phone learns which word you're likely to type next.
- Photo search finds "beach" or "dog" in your camera roll.
- Maps predict traffic from millions of journeys.
Why data is everything
A machine learning model only knows what its data shows it. This has big consequences.
Garbage in, garbage out. Mislabelled or messy data produces a poor model.
Bias in, bias out. If past hiring decisions favoured one group, a model trained on them will tend to favour that group too, while looking objective. A famous example: Amazon scrapped an experimental recruiting tool in 2018 after finding it downgraded CVs that mentioned women's organisations.
The world changes. A model trained on pre-pandemic shopping habits got many things wrong in 2020. Models need checking and retraining.
Data has owners. Who is allowed to use whose data for training is now one of the biggest legal and ethical questions in AI.
Where deep learning fits
Some machine learning models are simple, like a line drawn through points on a chart. The most powerful ones are neural networks with many layers, known as deep learning. Deep learning needs much more data and computing power, but can learn from messy, real-world things like images, sound and language.
Keep going
Common questions
Who came up with the term 'machine learning'?
Arthur Samuel, an IBM researcher, popularised it in 1959 while describing a checkers program that improved by playing against itself.
Do I need to know maths to use machine learning?
To use AI tools, no. To build machine learning systems from scratch, it helps to know some statistics, algebra and programming, usually Python, but many modern tools hide most of the maths.
What's the difference between a model and an algorithm?
The algorithm is the learning method, the recipe. The model is what you get after running that recipe on data: the trained result that makes predictions.
Spotted a mistake or something out of date? Tell us and we will fix it. Read how we research and write our articles.
Read next
What is artificial intelligence? A plain-English explanation
What AI actually is, how it learns, what it can and can't do, and why it suddenly seems to be everywhere. No jargon, no maths.
Updated 22 November 2026
AI vs machine learning vs deep learning: what's the difference?
AI, machine learning, deep learning, generative AI: people use these words as if they mean the same thing. Here's how they fit together, in one simple picture.
Updated 22 November 2026
How ChatGPT works: large language models explained simply
How do chatbots like ChatGPT, Claude and Gemini actually work? A plain-English explanation of large language models: tokens, training, prediction and why they sometimes get things wrong.
Updated 22 November 2026