10/20
Unsupervised Learning & K-Means Β· Page 1 of 1

Clustering Intuition

Unsupervised Learning & K-Means

No Labels? No Problem.

In Supervised learning, we have targets (y). In Unsupervised learning, we only have features (X). The algorithm must find hidden structure on its own.

What is K-Means?

K-Means groups data into 'K' distinct clusters based on feature similarity.

  1. Randomly place 'K' centroids.
  2. Assign every data point to its nearest centroid.
  3. Move the centroids to the exact center (mean) of their assigned points.
  4. Repeat steps 2 & 3 until the centroids stop moving.

Choosing K

How do you know how many clusters exist?

  • Domain Knowledge: (e.g., "I want to segment customers into 3 tiers").
  • The Elbow Method: Plot the total distance from points to their centroids. When the line looks like an "elbow", that's usually the right K.
main.py
Loading...
OUTPUT
β–ΆClick "Run Code" to execute…