Sharing notes from my ongoing learning journey — what I build, break and understand along the way.
Unsupervised Learning in Machine Learning: A Deep Dive with Examples and Concepts
Unsupervised Learning: How Machines Learn Without Labels
In this section, I want to explore how we can build models even when we have no labeled data at all. This brings us to unsupervised learning—a set of techniques used when there’s no known “correct answer” in the dataset. The model is expected to detect structure, patterns, and relationships in the data all on its own.
1. What Does It Mean to Have No Labels?
In supervised learning, each input is paired with a known output—like whether a customer got a loan, or if an email is spam.
In unsupervised learning, there are no such labels. We only have the inputs (features), such as age, click counts, visit duration, etc.
The model’s task is to explore the data and uncover:
- Groups of similar items
- Patterns of distribution
- Anomalies or hidden structures

2. Searching for Structure from Scratc
The key idea here is that we have a dataset with only features ( X \in \mathbb{R}^{n \times d} ), where:
- ( n ): number of observations
- ( d ): number of features
- and no labels ( y )
The model is expected to learn some underlying structure without being told what to look for.
$$
X \rightarrow \text{Clusters}(C_1, C_2, …, C_k)
$$
$$
X \rightarrow Z \in \mathbb{R}^{n \times k}, \quad \text{where } k < d
$$
The first represents clustering, the second dimensionality reduction.
3. A Realistic Everyday Example
Imagine you’re analyzing sensor data from city parking lots. You collect the number of vehicles entering and exiting, traffic by hour, street type, and day of the week—but you don’t know which locations are high-traffic or low-traffic. There are no labels.
An unsupervised learning algorithm could:
- Detect zones with similar traffic behavior
- Spot weekend vs weekday usage patterns
- Group areas that are only busy late at night
The output would be groupings of locations based on similarity, not pre-defined categories. You would decide later what those groupings mean in the real world (e.g., “commuter zones,” “nightlife areas,” etc.).
4. The Two Main Tasks in Unsupervised Learning
4.1 Clustering
Group similar data points together based on distance, density, or distribution—without being told what groups to look for.

Common clustering algorithms:
- K-Means
- DBSCAN
- Gaussian Mixture Models
Use cases:
- Segmenting website users based on behavior
- Detecting communities in social networks
- Grouping similar documents or images
4.2 Dimensionality Reduction
Reduce the number of features while retaining as much structure as possible. This is useful when the original dataset is high-dimensional.

Popular methods:
- PCA (Principal Component Analysis)
- t-SNE
- UMAP
Use cases:
- Visualizing high-dimensional data
- Removing noise
- Speeding up downstream model training
5. How Is It Different from Supervised Learning?
Supervised models are trained by comparing predicted outputs to known correct ones. There’s always a “teacher” to tell the model when it’s wrong.
Unsupervised models, on the other hand:
- Get no feedback
- Are not trained on known outputs
- Simply try to organize the input data in a meaningful way
This means you don’t judge accuracy the same way. There’s no “correct class.” The model just finds what it finds—and you decide whether that’s useful or not.
6. Where Is It Used?
Unsupervised learning has practical value in a surprising number of areas:
- User behavior analysis: Grouping visitors by navigation patterns
- Cybersecurity: Detecting anomalous traffic
- Healthcare: Identifying clusters of patients with similar conditions
- Gaming analytics: Finding playstyle patterns among players
- Natural language processing: Clustering documents or finding topic patterns

When I started comparing this with supervised models, the contrast became clear. In supervised learning, we already know what we’re looking for. In unsupervised learning, we’re not searching for the answer—we’re trying to figure out what the questions might be.
It’s a different mindset: the model doesn’t learn from labels—it learns from the structure hidden within the data.