Imagine you walk into a room full of 1,000 books.
Nobody tells you which books are about history, science, fiction, or business.
Your job is simply to look at the books and figure out which ones seem similar.
You might notice that some books contain lots of words about science, others talk about politics and history, while another group focuses on stories and characters.
You have just done something similar to unsupervised learning.
What is unsupervised learning?
Unsupervised learning is a type of machine learning where we give a model data without the answers.
The model looks at the data and tries to find patterns, similarities, or groups on its own.
For example, imagine we give a model information about 10,000 customers:
- How much they spend
- How often they shop
- What products they buy
- How often they visit the website
We don't tell the model that there are "budget shoppers", "frequent shoppers", or "premium customers."
Instead, we let it look at the data and discover groups that naturally exist.
The key idea:
Supervised learning learns from answers.
Unsupervised learning looks for patterns without answers.
Supervised vs. unsupervised learning
Think about studying for an exam.
Supervised learning
You solve a question and then check the answer at the back of the book.
If your answer is wrong, you adjust.
The computer works in a similar way. It gets:
Input → Correct answer → Learn
For example:
Customer information → Will they leave? → Yes/No
The model learns to make predictions because it has examples where the correct answer is already known.
Unsupervised learning
Now imagine the answer key has been removed.
You are given hundreds of questions and asked to figure out which ones are similar.
You might discover:
- These questions are about mathematics.
- These are about history.
- These are about science.
Nobody gave you those categories. You discovered them from the data.
That's unsupervised learning.
The main types of unsupervised learning
There are many techniques, but two ideas are especially important.
1. Clustering
Clustering means putting similar things into groups.
Imagine dumping 1,000 different fruits onto a table.
You could naturally create groups:
Apples → Oranges → Bananas → Mangoes
Nobody gave you the groups. You created them based on similarities.
Machine learning can do something similar with data.
Some common clustering techniques include:
- K-Means: Creates a specific number of groups.
- Hierarchical Clustering: Builds groups gradually, like a family tree.
- DBSCAN: Finds groups based on areas where data points are densely packed and can also identify unusual points.
The important thing isn't memorizing these names yet.
Remember:
Clustering = finding groups of similar things.
2. Dimensionality reduction
Sometimes our data has too many variables.
Imagine describing a car using 100 different measurements.
Engine size, weight, height, width, fuel consumption, horsepower, wheel size, price, acceleration... and 90 more.
Some of these measurements may tell us very similar things.
Dimensionality reduction tries to simplify the data while keeping the important information.
It's like taking a complicated 100-page report and reducing it to a 2-page summary without losing the main message.
For now, the important idea is:
Dimensionality reduction = simplifying complicated data while keeping the important patterns.
Where is unsupervised learning used?
Unsupervised learning is useful when we have lots of data but don't already know what we're looking for.
Customer segmentation
A company may have thousands of customers but no clear idea how to group them.
Clustering might reveal groups such as:
- Customers who buy frequently
- Customers who spend a lot
- Customers who only buy during promotions
The business can then treat these groups differently.
Fraud and anomaly detection
Imagine you normally use your bank card around Nakuru and spend between KSh 500 and KSh 5,000.
Suddenly, there's a KSh 300,000 transaction in another country.
That transaction looks very different from your normal behaviour.
Unsupervised learning can help identify these unusual patterns.
The model isn't necessarily told:
"This transaction is fraud."
Instead, it learns what normal behaviour looks like and flags things that look unusual.
Recommendation systems
Think about Netflix, Spotify, or an online shop.
Millions of users interact with thousands of products, movies, or songs.
By finding patterns in what people watch, listen to, or buy, systems can discover that:
"People who behave like you often like these things too."
That can be used to recommend something you might enjoy.
The big picture
Unsupervised learning is essentially about discovering structure in messy data.
You give the computer data without labels and ask:
"What patterns can you find?"
It might discover groups.
It might find unusual behaviour.
It might simplify complicated data.
It might uncover relationships that weren't obvious to us.
And that's what makes unsupervised learning so useful.
The one thing to remember
Think of unsupervised learning like walking into a messy room and organizing it without being given instructions.
You look around, notice similarities, and create your own structure.
Supervised learning:
"Here are the answers. Learn to predict them."
Unsupervised learning:
"Here is the data. What can you discover?"
Top comments (0)