Types of Machine Learning
How does a machine learn when nobody gives it the answers? Navika's teacher can help her learn in three ways. She can give her worked examples with the answers. She can hand her a pile of leaves and ask her to sort them into groups, without naming any. Or she can let her play a game and say "good move" or "bad move" after each turn.
Machines learn in the same three ways, and what the examples look like decides which way fits. This lesson explains supervised, unsupervised and reinforcement learning, with one picture each.
The Three Types at a Glance
Supervised Learning: Learning with Answers
In supervised learning, every example comes with its correct answer, called a label. The model learns to connect the example to the answer, then predicts answers for new examples.
It is like studying with worked examples: you see the question and the answer many times, until you can answer new questions yourself.
| Task | Example | Label (the answer) |
|---|---|---|
| Spam filter | An email | Spam or not spam |
| Photo sorting | A photo | Dog or cat |
| House pricing | A house's size, bedrooms, age and location | Its sale price |
| Medical scans | An X-ray | Signs of disease or not |
Supervised tasks come in two kinds. Classification predicts a category, such as spam or not spam. Regression predicts a number, such as a price. Supervised learning is the most common type in everyday products, and the house-price example in "Traditional Programming vs Machine Learning" was a tiny case of it.
Unsupervised Learning: Finding Groups Without Labels
In unsupervised learning, the examples have no labels. The model looks for structure on its own, most often groups of similar examples, called clusters.
It is like sorting a pile of leaves by shape and color without knowing any tree names. You can make sensible groups, but you can't name them.
| Task | What it finds |
|---|---|
| Customer groups | Shoppers with similar buying habits, such as weekend shoppers or bargain hunters |
| Topic discovery | Groups of similar support messages, before anyone has named the topics |
| Unusual activity | A payment or login that doesn't fit any normal group |
The model finds the groups, but a person still has to decide what each group means and whether it is useful.
Reinforcement Learning: Learning by Trial and Reward
In reinforcement learning, a system called an agent takes actions, and after each action it gets a reward (or none, or a penalty). Over many tries, it learns which actions lead to the most reward.
As an analogy, think of a dog learning tricks: it tries something, gets a treat or not, and repeats what earned the treat. Nobody shows the agent the right answer; the reward tells it how well it did.
| Example | Action | Reward |
|---|---|---|
| AlphaGo | Choosing a move in Go | Winning the game |
| A warehouse robot | Choosing a path | Delivering quickly without collisions |
| A game-playing program | Pressing buttons | Points scored |
Reinforcement learning is powerful, but it needs a very large number of tries, so it is often trained in simulations and games. It is also one of the steps used to make chat assistants more helpful, as a later chapter explains.
Common Mistakes
Thinking unsupervised learning knows what its groups are. It finds similar examples; a person decides what each group means.
Thinking one product uses only one type. Many systems combine types, for example finding customer groups first, then predicting each group's spending.
Confusing a reward with a label. A label is the right answer for one example; a reward only says how good an action turned out.
Thinking reinforcement learning is how most apps learn. Most everyday features, such as spam filters and recommendations, rely mainly on supervised learning.
Interview Corner
What is the difference between supervised and unsupervised learning?
Supervised learning trains on labeled examples, so it learns to predict the answer, such as spam or not spam. Unsupervised learning trains on unlabeled examples and finds structure on its own, such as groups of similar customers.
What is reinforcement learning? Give an example.
An agent learns by trying actions and receiving rewards, and gradually prefers the actions that earn the most reward. AlphaGo improved at Go by playing many games, with winning as the reward.
What are classification and regression?
Both are kinds of supervised learning. Classification predicts a category, such as dog or cat. Regression predicts a number, such as a house price.
Practice
Exercise: name the type. For each task, write supervised, unsupervised or reinforcement, and one sentence explaining why:
- Grouping a school's students by study habits, without any categories decided in advance.
- Predicting whether a fee payment will be late, from past payments marked late or on time.
- Teaching a robot vacuum to clean a room faster, with a reward for each clean square.
Check your answers against the tip above.
Check your understanding:
- What is a label?
- Why can't an unsupervised model name its groups?
- What tells a reinforcement learning agent how well it did?
Key Takeaways
Quick reference
| Term | Meaning |
|---|---|
| Supervised learning | Learning from examples with labels |
| Label | The correct answer attached to an example |
| Classification | Predicting a category |
| Regression | Predicting a number |
| Unsupervised learning | Finding structure in examples without labels |
| Cluster | A group of similar examples |
| Reinforcement learning | Learning from rewards for actions |
| Agent | The system that takes actions in reinforcement learning |
Was this tutorial helpful?