Why this matters
Nobody can write down the rule that separates a photo of a cat from a photo of a dog. Machine learning exists for exactly the problems where the rule cannot be written but examples are easy to find. Understanding the swap it makes, data instead of rules, is what makes the rest of AI legible.
The idea
| Approach | Humans provide | The computer does |
|---|---|---|
| Conventional programming | The rules, plus input data | Follows the rules to produce answers |
| Machine learning | Large amounts of data, with correct answers where available | Finds the rules itself |
This suits problems whose rules are too complex to state: is this a dog or a cat, is this email spam, what words are in this audio.
It is not magic. Biased training data gives biased judgments, and the black-box problem means the basis of a decision can be hard for anyone to see. Both are reasons to treat machine learning as support for human judgment, not a replacement.
Three types, distinguished by what data they get:
| Type | Data given | What it learns |
|---|---|---|
| Supervised learning | Input paired with the correct answer (label) | Rules for predicting the answer from the input |
| Unsupervised learning | Input only, no answers | Hidden structure or groups |
| Reinforcement learning | Actions and the rewards they earn | How to choose actions that get better results |
Classification is the standard supervised task: predict which class an input belongs to, such as spam or normal, dog or cat or bird. It runs in two stages, training (find the rules from labelled pairs) and prediction (apply them to new data). The clues it uses are features: in spam classification, the words in the email, the sender's address, the length of the body. Choosing features that suit the purpose matters a great deal to accuracy.
Clustering is the standard unsupervised task: group similar items together when nobody has said what the groups are. Shoppers with similar buying habits, listeners with similar taste, news articles on the same topic. The single difference from classification is whether labels were given in advance.
Reinforcement learning is different from both: it learns from the consequences of its own actions rather than from a stated correct answer. Its three elements are the state (the situation), the action (the choices available), and the reward (a number saying how good the result was). It suits problems where nobody knows the right answer but everyone can recognise a good outcome, which is why it pairs with games and simulators where trial and error is cheap.
Picture it
flowchart TD
Q{What does your data have?} --> A[Inputs with correct answers]
Q --> B[Inputs with no answers]
Q --> C[Actions you can score]
A --> A1["Supervised learning, e.g. classification"]
B --> B1["Unsupervised learning, e.g. clustering"]
C --> C1[Reinforcement learning]
Worked example
A shop has a year of purchase records and wants to use them. Which type of learning?
It depends entirely on the question, not the data. "Which customers will probably cancel their subscription next month?" is supervised, because past customers who cancelled provide the labels, and the task is classification into likely and unlikely. The features might be months subscribed, purchases in the last 90 days, support tickets opened.
"What kinds of customer do we actually have?" is unsupervised. Nobody knows the groups in advance; that is the question. Clustering finds them from buying patterns, and a person then looks at the result and decides what each group means and whether it is useful. The algorithm finds the grouping; it does not name it or say it matters.
"What order should we show recommendations in to maximise purchases?" is reinforcement learning territory, because there is no correct answer to copy, but every choice produces a reward you can measure.
Same records, three different techniques, chosen by what you want to know.
Your turn
Try the practice questions for this lesson. Judge statements about the three types of learning, match each description to its term, and work out which type suits a given problem.
Take it further
Your school has years of data and wants help with two things: flagging students who may need extra support early, and discovering groups of study habits nobody defined. Should the model decide alone, or should a person stay in charge?
- Identify the method. For each task, name the learning type that fits, and one piece of data it would need.
- Analyse the risk. For the first task, say what could go wrong if the training data reflects past decisions that were themselves unfair.
- Decide. Recommend how each result should be used, and name who is accountable for a decision that affects a student.
The second task has no correct answer to learn from, which is what decides its method.
Recap
- Conventional programming is given rules; machine learning finds them from data.
- Supervised learns from labels, unsupervised finds groups, reinforcement learns from rewards.
- Classification predicts a class using features; clustering finds groups nobody specified.
- Biased data gives biased judgments, and the black-box problem keeps a human in the loop.