Types of Machine Learning
Machines can learn with answers, without answers, with a few answers, or by trial and error. Here is how each works.
By the end of this lesson you will be able to
- name the four main ways a machine can learn from data
- tell which type fits a given problem by looking at the data you have
- connect each type to everyday products and AWS services
In Machine Learning, learning means the way a model picks up patterns from data. What decides the type of learning is simple: what kind of data do you give the model, and what feedback does it get?
| Type | Data required | Goal | Real-life examples | AWS services |
|---|---|---|---|---|
| Supervised | Labelled data (input + correct output) | Predict the correct output | Spam detection, house price prediction, disease diagnosis | SageMaker AI, Rekognition, Comprehend |
| Unsupervised | Unlabelled data | Find hidden patterns or groups | Customer segmentation, fraud detection, market basket analysis | SageMaker AI |
| Semi-supervised | A little labelled data + a lot of unlabelled data | Improve accuracy with limited labels | Medical image classification, speech recognition, document classification | SageMaker AI |
| Reinforcement | Rewards and penalties | Learn the best actions by trial and error | Self-driving cars, robot navigation, chess and Go, recommendation optimisation | SageMaker AI (RL toolkit) |
1. Supervised learning
The model learns from labelled data: every example comes with the correct answer.
Suppose we teach a model with three houses whose prices we already know:
| Input: house size | Output: price |
|---|---|
| 1000 sq ft | ₹40 lakh |
| 1500 sq ft | ₹60 lakh |
| 2000 sq ft | ₹80 lakh |
The model notices the pattern (about ₹4,000 per square foot). Now, for a house it has never seen, like 1800 sq ft, it predicts ≈ ₹72 lakh.
Where you see it: spam email detection, face recognition, loan approval, weather prediction, disease diagnosis.
2. Unsupervised learning
The model receives only inputs, no answers, and discovers hidden structure by itself.
Suppose you own a supermarket and have this customer data, with no labels at all:
| Customer | Age | Income |
|---|---|---|
| A | 22 | Low |
| B | 24 | Low |
| C | 45 | High |
| D | 47 | High |
Nobody told the algorithm what the groups are, yet it automatically finds two: young, lower-income customers (A, B) and middle-aged, higher-income customers (C, D). The shop can now design different offers for each group.
Where you see it: customer segmentation, recommendation systems, market basket analysis, fraud and anomaly detection.
3. Semi-supervised learning
Only a small part of the data is labelled. The model learns from both parts.
A hospital has 10,000 X-rays, but doctors have only had time to label 100 of them as “cancer” or “no cancer”. Labelling all 10,000 by hand would take months. Instead, the algorithm learns from the 100 labelled images, uses that knowledge to infer labels for the other 9,900, and learns from those too.
Where you see it: medical imaging, speech recognition, OCR, image classification. Anywhere labels are expensive but raw data is plentiful.
4. Reinforcement learning (RL)
The model learns by interacting with an environment and receiving rewards or penalties.
Attempt 1
The robot tries to walk… and falls. Penalty.
Attempt 2
The robot walks more carefully… and moves forward. Reward.
After thousands of attempts, the robot discovers the best walking strategy. Nobody gave it the “correct” movement; it found it through trial and error.
Where you see it: self-driving cars, robotics, game-playing AI, trading strategies, recommendation systems that adapt as you click. It is also how chatbots like ChatGPT are fine-tuned to be helpful (you will meet this as RLHF in lesson 10).
Quick comparison
| Feature | Supervised | Unsupervised | Semi-supervised | Reinforcement |
|---|---|---|---|---|
| Labelled data | ✅ Yes | ❌ No | ⚠️ Partial | ❌ No |
| Learns from | Correct answers | Hidden patterns | Labelled + unlabelled data | Rewards and penalties |
| Main goal | Prediction | Grouping, pattern discovery | Better prediction with fewer labels | Best decision-making |
| Output | A class or a value | Clusters, associations | A class or a value | An optimal action (policy) |
| Example | Spam detection | Customer segmentation | Medical diagnosis | Self-driving car |
Supervised: you give students questions with the correct answers; they learn by comparing.
Unsupervised: you give students a box of mixed objects and ask them to group similar items, with no instructions.
Semi-supervised: you solve a few examples on the board, then students solve many similar problems on their own.
Reinforcement: students gain marks for right answers and lose marks for mistakes; over time they learn the strategy that scores highest.
(a) Grouping news articles into topics nobody has defined. (b) Predicting tomorrow's temperature from 10 years of records. (c) Teaching a drone to land using a points system.
Show answers
(a) Unsupervised. (b) Supervised: past records have the “answer” (the actual temperature). (c) Reinforcement.
Key takeaways
- Look at the data first: labels → supervised; no labels → unsupervised; a few labels → semi-supervised; rewards → reinforcement.
- Supervised learning predicts; unsupervised learning discovers; reinforcement learning decides.
- Semi-supervised learning is a practical middle ground when labelling is expensive.
Check your understanding
1. A bank has millions of transactions but no labels, and wants to find unusual ones. Which type fits best?
Without labels, the model looks for transactions that don't fit the normal patterns: anomaly detection, an unsupervised task.
2. What makes reinforcement learning different from the other three?
RL learns by acting in an environment and receiving feedback, rather than from a fixed dataset of examples.
3. Why use semi-supervised learning?
It squeezes more value out of a small labelled set by also learning from plentiful unlabelled data.