Shopper Segments
K = –

Five kinds of shoppers walk into this mall.

. We scale each customer's age, annual income and spending score, then let K-Means find the groups, so every group can get an offer that suits it.

Student
Roll no.
Subject
College

Getting the data ready

Each dot is one customer.

Drag to scrub
Annual income (₹ lakh) left to right, spending score bottom to top. Crosses are the cluster centres and the dashed lines show the path each centre moved.

Customers

Average age

Average annual income

Average spending score

What the customers look like

How the 3 clustering features are spread out, and the gender split.

Age

Annual income (₹ lakh)

Spending score

Gender

How it works

  1. 1

    Scale the numbers

    Income is in lakhs of rupees, age in years and the score runs 1 to 100. StandardScaler puts every column on the same scale (mean 0, spread 1), so no single column decides who is "close" to whom.

  2. 2

    Pick K with the elbow method

    We try K = 2 to 10 and plot WCSS, how spread out the groups are. Where the curve bends like an elbow, extra groups stop helping much. The silhouette score (higher is better) double-checks the choice.

  3. 3

    Group with K-Means

    K-Means drops K centre points, gives each customer to the nearest centre, moves each centre to the middle of its customers, and repeats until nothing changes. Each final group becomes a segment.

Try it on your own data

Upload a CSV with the columns CustomerID, Gender, Age, Annual Income (k$) and Spending Score (1-100), 30 to 5,000 rows. The whole app re-trains on it.

Loading…

Chart

Reading your data

0%

  1. Reading the file
  2. Checking columns and values
  3. Scaling, then K-Means for K = 2 to 10
  4. Finding and naming the segments
  5. Recording every training step