Week7 Progress: Unsupervised Learning & Dimensionality Reduction
This week in my machine learning journey, I explored unsupervised learning techniques and dimensionality reduction methods. Unlike supervised learning, where models learn from labeled data, unsupervised learning focuses on discovering hidden patterns and structures within unlabeled datasets.
These concepts are widely used in data exploration, recommendation systems, anomaly detection, and visualization. In this article, I’m sharing what I learned and how these techniques help uncover insights from data.
Understanding Unsupervised Learning
Unsupervised learning is a branch of machine learning where algorithms analyze and group data without predefined labels. The goal is to identify patterns, relationships, or structures within the data.
Common tasks include:
- Clustering — grouping similar data points
- Dimensionality reduction — simplifying data while preserving important information
- Association rule learning — finding relationships between variables
This week I explored several important techniques in these categories.
1. K-Means Clustering (Implemented from Scratch)
One of the first algorithms I studied was K-Means clustering, a simple yet powerful clustering technique.
The main idea behind K-Means is to divide a dataset into K clusters, where each data point belongs to the cluster with the nearest centroid.
How the Algorithm Works
- Choose the number of clusters K
- Initialize K centroids randomly
- Assign each data point to the nearest centroid
- Recalculate centroids based on cluster members
- Repeat until centroids stop changing
Implementing K-Means from scratch helped me understand how clustering works internally instead of relying on pre-built libraries.
Key Takeaways
- Distance metrics (usually Euclidean) determine cluster assignments
- The algorithm may converge to local minima
- Choosing the right value of K is important
2. Hierarchical Clustering for Data Analysis
Next, I explored Hierarchical Clustering, which builds clusters step-by-step in a tree-like structure called a dendrogram.
There are two approaches:
Agglomerative (Bottom-Up)
- Start with each point as its own cluster
- Merge the closest clusters until one cluster remains
Divisive (Top-Down)
- Start with one large cluster
- Split it into smaller clusters recursively
Why Hierarchical Clustering is Useful
- No need to predefine the number of clusters
- Provides a visual hierarchy through dendrograms
- Useful for exploratory data analysis
This technique is especially helpful when trying to understand natural groupings in data.
3. Principal Component Analysis (PCA)
High-dimensional data can be difficult to analyze and visualize. Principal Component Analysis (PCA) is a dimensionality reduction technique that transforms data into a lower-dimensional space while preserving as much variance as possible.
Key Concept
PCA finds principal components, which are new axes that maximize the variance in the dataset.
Get Anees Ahmad’s stories in your inbox
Join Medium for free to get updates from this writer.
Instead of using all original features, we can represent data using fewer components.
Benefits of PCA
- Reduces computational complexity
- Removes redundant features
- Helps visualize high-dimensional datasets
- Often improves model performance
Understanding PCA gave me insight into how we can compress information without losing important patterns.
4. t-SNE for Data Visualization
Another dimensionality reduction technique I learned was t-SNE (t-distributed Stochastic Neighbor Embedding).
Unlike PCA, which is linear, t-SNE is a non-linear method designed mainly for visualization.
What Makes t-SNE Special?
- Excellent for visualizing high-dimensional data
- Preserves local structure of the dataset
- Often used for 2D or 3D visualization
It’s commonly used to visualize embeddings from deep learning models or complex datasets.
5. Association Rule Mining (Apriori Algorithm)
Finally, I explored Association Rule Mining, which identifies relationships between items in large datasets.
The most common algorithm for this task is Apriori.
Example Use Case
In retail analytics, Apriori can find rules such as:
Customers who buy bread and butter often buy milk.
Key Metrics
- Support — frequency of the itemset in the dataset
- Confidence — likelihood of the rule being true
- Lift — strength of the association
These rules are widely used in market basket analysis and recommendation systems.
Reflections From This Week
This week helped me understand how machine learning models can extract patterns from unlabeled data.
Some important lessons I learned:
- Implementing algorithms from scratch deepens understanding
- Dimensionality reduction is essential for handling complex datasets
- Visualization techniques help reveal hidden structures in data
- Pattern discovery can provide valuable business insights
Unsupervised learning plays a crucial role in real-world data analysis, especially when labeled data is limited.
What’s Next?
In the coming weeks, I plan to continue expanding my machine learning knowledge by exploring:
- More advanced clustering techniques
- Feature engineering
- Real-world machine learning projects
Each week brings new concepts and challenges, but the journey of learning machine learning is incredibly rewarding.
Thanks for reading
If you’re also learning machine learning, feel free to share your journey or insights.






