← Learning Hub
Intermediate

Clustering: Finding Customer Groups

K-means puts data into k groups so that points in a group are close together. No labels needed - great for customer segments.

Clustering finds natural groups in data without being told the answers - customers who shop alike, products bought together. Businesses use it to tailor offers and understand their users. The groups still need a human to name them and check they make sense.

Example
You can edit this code.

The model found the three kinds of shopper on its own. A shop could send different offers to each group.

How many groups?

Example
You can edit this code.
Clustering always gives you groups, even in random data. Check they make business sense before acting on them.
Key points
  • K-means groups points by distance.
  • Scale features first.
  • Silhouette score helps choose the number of groups.

📝 Test yourself

1. Does K-means need labelled answers?
2. Why scale before K-means?
3. Fill in the setting for the number of groups:
KMeans(=3)