Back to Education
Machine Learning Specialization · Unsupervised Learning, Recommenders, Reinforcement Learning
K-Means Clustering and Image Compression
A clustering milestone that implements K-Means from scratch, then uses it to compress an RGB image by replacing thousands of colors with centroid colors.
K-MeansCentroid assignmentCentroid updateUnsupervised clusteringImage compression
What this project is about
K-Means is shown twice: first as clustering in a 2D feature space, then as color compression. The same centroid assignment/update loop becomes a visual compression algorithm when pixels are treated as RGB points.
Implementation focus
This project made unsupervised learning concrete. Reducing an image to 16 color centroids is easier to understand than only plotting clusters, and it shows how a simple algorithm can solve a practical compression problem.
Key results and artifacts
- 2D dataset: 300 samples, 3 clusters
- Bird image: 128×128×3 reshaped to 16,384 pixels
- Compressed to K=16 colors
What I learned
This made unsupervised learning visible: the same centroid logic can group points and also reduce image color complexity.
Milestone deep dive
What this project proves in my learning path.
A clustering milestone that implements K-Means from scratch, then uses it to compress an RGB image by replacing thousands of colors with centroid colors. The milestone is included because it shows a complete learning unit: a problem, a data representation, an implementation path, measurable outputs, and a lesson that later connects to larger AI systems.
Input layerfeature matrices and geometric structure
Model layerunsupervised algorithm or probabilistic model
Evaluation layertests, metrics, plots, or qualitative output
Artifact layerclusters, projections, compressed images, or outliers
Problem framingWhat I was trying to solve
This page is not just a lab description. It explains how I transformed the assignment idea into an engineering story: what the model receives, what it optimizes, what output it should produce, and how the result can be inspected.
ImplementationWhat I coded or assembled
The implementation focus was the mechanism behind the result: functions, model blocks, training logic, preprocessing, evaluation, and the small technical details that make the notebook work rather than only look correct.
ConceptsCore concepts
K-MeansCentroid assignmentCentroid updateUnsupervised clusteringImage compression
These tags show the technical ideas this milestone added to my toolkit.
Learning resultWhat changed after it
This made unsupervised learning visible: the same centroid logic can group points and also reduce image color complexity.
Important outputs and evidence
- 2D dataset: 300 samples, 3 clusters
- Bird image: 128×128×3 reshaped to 16,384 pixels
- Compressed to K=16 colors
How I would explain it in an interview
I would describe this milestone by starting from the data representation, then explain the model or algorithm, then show what was measured. The important part is not only the final number; it is the ability to reason about why the method works, what assumptions it makes, and what limitations should be improved next.