What is machine learning? It is the technology behind your spam filter, your Netflix recommendations, the face unlock on your phone and, at a much bigger scale, tools like ChatGPT. Yet the core idea is surprisingly simple: instead of telling a computer exactly what to do, you show it lots of examples and let it work out the rules for itself.
In this guide you'll learn how that works in plain English, try training a tiny spam filter yourself, and finish with a quick quiz. No maths, no code.
What is machine learning, in one sentence?
Machine learning is a way of building software that learns from examples instead of following rules a person wrote by hand.
Think about how a child learns what a dog is. Nobody hands them a rulebook (“four legs, fur, a tail, barks, unless it's a very quiet dog…”). They simply see lots of dogs, get corrected now and then (“no, that's a cat”), and gradually build their own sense of “dog”. Machine learning works the same way, just with numbers, data and a lot more examples.
Traditional programming vs machine learning
In traditional programming, a developer writes the rules and the computer follows them: data and rules go in, answers come out. That works brilliantly for things like calculating tax or sorting a list.
But some problems are almost impossible to write rules for. What exact rules would recognise every handwritten “7”, or every spam email, including the clever new ones? In machine learning, you flip it around: you give the computer data and the answers, and it produces the rules, which we call a model.
How machine learning works, step by step
Almost every ML project follows the same basic recipe:
- Collect examples (data). For a spam filter: thousands of emails, each marked spam or not spam.
- Pick the clues (features). Things the model can measure, like the number of links, words in ALL CAPS, or whether the sender is in your contacts.
- Train the model. The model makes a guess for each example, checks how wrong it was, and nudges its internal settings to be a little less wrong next time. Repeat, many times over.
- Test it on new data. Keep some examples hidden during training, then check how well the model does on them. This is the honest score.
- Use it to predict. Once it's good enough, the model sorts brand-new emails it has never seen.
Try it: train a tiny spam filter
Below, each dot is an email, placed by two clues: how many links it has and how many words are in ALL CAPS. Red dots are spam, green dots are not. The coloured background shows what the model currently predicts for any new email in that spot.
Click the chart to add your own examples and watch the model's decision change. This model uses a simple method called k-nearest neighbours: it labels a new email the same way as the few examples closest to it.
🧪 Train a tiny spam filter
16 examples · 8 spam · 8 not spamPick a label, then click anywhere on the chart to add an example email.
💡 Try this: add one spam dot deep inside the green area, then switch k between 1 and 5. With k = 1 the model obeys that single odd example (overfitting); with k = 5 it trusts the crowd.
Notice two things. First, more (and more varied) examples make the boundary smarter. Second, a single odd example can create a strange little island when the model only looks at its one closest neighbour. That's a tiny taste of a real problem called overfitting, which we'll come back to.
The 3 types of machine learning
Machine learning comes in three main flavours, depending on what kind of examples and feedback the model gets.
1. Supervised learning: learning with answers
The model learns from labelled examples, where each example comes with the right answer. Emails marked spam or not spam, house listings with their sale prices, photos tagged “cat”. It's the most common type, and the demo above is supervised learning.
2. Unsupervised learning: finding hidden groups
Here the data has no labels. The model's job is to discover structure on its own, such as grouping customers with similar shopping habits or spotting a transaction that looks unlike all the others.
3. Reinforcement learning: learning by trial and error
The model (often called an agent) takes actions and receives rewards or penalties, like points in a game. Over many attempts it learns which actions lead to the best results. It's used for games, robotics and fine-tuning chat assistants with human feedback. If you're curious how agents act in the real world, see our guide on what an AI agent is.
🎯 Which type of ML is it?
6 scenarios1. Predict a house's price from thousands of past sales with known prices.
2. Group a shop's customers into segments, without knowing the groups in advance.
3. Teach a robot to walk by rewarding it every time it moves forward without falling.
4. Recognise handwritten digits using images already tagged 0–9.
5. Flag unusual card payments that don't look like any normal spending pattern.
6. Train a game AI that gets points for winning and loses points for losing.
Machine learning examples you already use
- Spam filters that keep junk out of your inbox.
- Recommendations for videos, songs and products based on what similar people enjoyed.
- Photo search that finds “beach” or “dog” in your gallery without tags.
- Maps that predict traffic and arrival times.
- Voice assistants that turn speech into text.
- Fraud detection that flags unusual card payments.
- Chat assistants like ChatGPT, Claude and Gemini.
Machine learning vs AI vs deep learning
These three terms get mixed up constantly. Picture three circles, one inside the other:
- Artificial intelligence (AI) is the big circle: any technique that lets computers do tasks that normally need human intelligence.
- Machine learning sits inside it: AI that learns from data instead of hand-written rules.
- Deep learning sits inside ML: machine learning with large neural networks, loosely inspired by the brain. It powers modern language models (see how ChatGPT works) and AI image generators.
The limits of machine learning
ML is powerful, but it isn't magic. A few honest limits every beginner should know:
- Garbage in, garbage out. A model only knows what its examples taught it. Incomplete or unfair data leads to wrong or biased predictions.
- Overfitting. Like a student who memorises last year's exam answers, a model can learn its training examples too precisely and then fail on anything new. Testing on unseen data catches this.
- It needs data, often a lot of it. Rare situations the model never saw can trip it up.
- It can be hard to explain. Big models often can't tell you why they made a particular prediction.
Where to go next
Now that you know how machines learn from examples, you're ready for the most famous example of all: how ChatGPT works. And once you start using AI tools, these prompt engineering tips will help you get much better answers.
Key takeaways
- Machine learning is software that learns patterns from examples instead of following hand-written rules.
- Training is a loop of guess, measure the mistake, adjust, repeated many times.
- The three main types are supervised (labelled examples), unsupervised (find patterns) and reinforcement (learn from rewards).
- Always test a model on data it has never seen to know how it will really perform.
- A model is only as good as its data, so watch for bias and overfitting and keep humans involved in big decisions.
Frequently asked questions
What is machine learning in simple words?
Machine learning is a way of building software that learns from examples instead of following rules a person wrote by hand. You show it lots of examples (emails marked spam or not spam, photos labelled cat or dog) and it finds the patterns itself, then uses them to make predictions about new examples it has never seen.
What is the difference between AI and machine learning?
Artificial intelligence is the big goal: computers doing tasks that normally need human intelligence. Machine learning is the most common way we achieve that goal today, by learning from data. Deep learning is a type of machine learning that uses large neural networks, and it powers tools like ChatGPT and AI image generators.
Do I need maths or coding to understand machine learning?
Not to understand the ideas. The core concepts (examples, patterns, training, mistakes, predictions) can be learned without any maths, as this guide shows. Building your own models does involve some coding and statistics, but plenty of beginner-friendly tools let you start small.
What are the three types of machine learning?
Supervised learning learns from labelled examples, like emails already marked spam. Unsupervised learning finds groups and patterns in unlabelled data, like grouping customers by shopping habits. Reinforcement learning learns by trial and error from rewards, like a game-playing AI that gets points for winning.
Can machine learning be wrong or biased?
Yes. A model can only be as good as the examples it learned from. If the data is incomplete, outdated or unfair, the model can make wrong or biased predictions. That is why good ML projects test models carefully, monitor them after launch and keep humans involved in important decisions.
🧠 Quick check: machine learning basics
1. What makes machine learning different from traditional programming?
2. A model learns from emails that are already marked “spam” or “not spam”. Which type of ML is this?
3. What does “overfitting” mean?
4. Why is testing on new, unseen data important?