Types of Machine Learning
Machine Learning Fundamentals with Python
3 min read
Published Nov 16 2025
Guide Sections
Guide Comments
Machine Learning methods can be broadly grouped into three main types: Supervised, Unsupervised, and Reinforcement learning.
Each category is based on the type of data we have and the goal we’re trying to achieve.
Supervised Learning
Idea:
We already know the correct answers (labels) for our data. The model’s job is to learn the relationship between inputs (features) and outputs (labels). In other words, the model is supervised by example answers.
Common tasks:
- Regression: Predict continuous values, e.g. house prices, temperatures
- Classification: Predict discrete categories, e.g. spam or not spam, dog vs cat
Python example
Simulate a very small example with Scikit-learn to show how supervised learning works:
Explanation:
- We have labeled data (
spamornot spam). - The model learns patterns (e.g., more links or “offer” keywords = spam).
- Then we test how well it performs on unseen data.
- Predictions - What the model thinks the labels should be based on patterns it learned during training.
- Actual - The real, correct labels that come from your original dataset, NOT from the model.
- Accuracy - What fraction of the predictions the model got right, (1 is 100% correct, 0,5 is 50% correct, 0 is 0% correct etc.)
This is supervised learning because the correct answers were known during training.
Unsupervised Learning
Idea:
Here, we don’t have labels. The goal is to find patterns, structure, or groupings on our own.
Common tasks:
- Clustering: Grouping similar items together, e.g. customer segmentation
- Dimensionality reduction: Simplifying complex data, e.g. compressing features for visualisation
Python example
Clustering customers by spending behaviour using KMeans to automatically group customers based on spending habits.
Explanation:
- We had no labels, the algorithm automatically grouped the data into clusters.
- Each cluster might represent a type of customer, e.g. “low spenders” vs “high spenders”.
- This is unsupervised learning, the model discovered structure without supervision.
- The cluster labels is assigning the data in to two groups of 0 or 1.
- The cluster centres are the centroids of the clusters, eg. [18.0, 23.75] represent customers with income ≈ 18 and low spending score ≈ 24.
- So the two groups are:
- Group 1: Low Spenders - These might be customers with modest spending habits.
- Income range: 15–21
- Spending score: 6–40
- Centered around: (~18, ~24)
- Group 2: High Spenders - These are the high-spending customers.
- Income range: 16–22
- Spending score: 76–94
- Centered around: (~19, ~82)
Reinforcement Learning
Idea:
The model (called an agent) learns by interacting with an environment. It takes actions, receives rewards or penalties, and learns which actions lead to the best outcomes.
Common applications:
- Game playing, e.g. AlphaGo, chess engines
- Robotics and autonomous driving
- Dynamic decision-making, e.g. trading bots
We won't show python example of a full reinforcement learning demo here (it usually needs simulations), but here’s the intuition:
Example:
- The agent is a robot learning to walk.
- Each step forward = reward (+1), falling down = penalty (–10).
- Over time, it learns which movements lead to higher total rewards.
Summary
Learning Type | Has Labels? | Goal | Example |
Supervised | Yes | Learn mapping from inputs → outputs | Predict house prices |
Unsupervised | No | Find structure or patterns | Cluster customers |
Reinforcement | No - but gets rewards | Learn actions that maximize long-term reward | Train an AI to play a game |














