← Back to portfolio
Case Study · 05 / 17
Analytics · Clustering · 2025

Three thousand shoppers,
five honest segments.

Six months of loyalty-card data from a convenience-store chain, turned into five customer groups a marketing team can actually act on — Core Grocery, Tobacco Convenience, Cashpoint Users, Drinks & Tobacco, and Lottery-Focused. Here's how the segments were built and why five was the right number.

Role
Solo — customer analytics
Context
MSc Business Analytics coursework
Stack
Pandas · scikit-learn · PCA · K-Means
Status
Completed study
Fig. 05 · basket → segment
05
A segment is only useful if a human can name it in one breath.
§ 01 — The problem

"All customers" is not a strategy.

A convenience chain that treats every shopper the same wastes its marketing budget. But the raw data — baskets, category spends, line items — doesn't hand you groups; it hands you thousands of rows of behaviour. The job was to find the natural seams in that behaviour and describe them in language a store manager would recognise.

The target was interpretability first: five segments, each with a plain "pen portrait" and a clear marketing recommendation — not a cluster diagram nobody can act on.

Retail spend is skewed. Model it as if it isn't and you cluster the outliers.

§ 02 — Constraints

Rules for trustworthy segments.

§ 03 — Architecture

From four tables to five groups.

Four datasets — customer summaries, baskets, category spends, and line items — were joined into customer-level features, cleaned of skew, reduced with PCA, and clustered with K-Means.

01 — Engineer
Features
Frequency, spend, basket size, recency, time-of-day, category preference.
02 — Preprocess
De-skew
Winsorise outliers, log-transform magnitudes, scale with RobustScaler.
03 — Reduce
PCA
Principal components cut dimensionality and de-correlate features before clustering.
04 — Cluster
K-Means
Five clusters chosen by inertia + silhouette, then profiled into pen portraits.

Category spend became proportional preference features rather than raw pounds — so a light spender who buys mostly tobacco lands next to a heavy one with the same tilt, which is the behaviour marketing actually cares about.

§ 04 — What the clusters revealed

One segment carries the value.

The five groups split cleanly: Core Grocery Shoppers with large, diverse baskets; Tobacco Convenience Buyers and Drinks & Tobacco Shoppers around focused convenience purchases; Cashpoint Users making small trips tied to cash withdrawals; and a very small Lottery-Focused group.

The recommendation followed the money: prioritise Core Grocery Shoppers for loyalty rewards and basket-building, use point-of-sale promotions for the tobacco and drinks segments, place impulse offers near the cashpoint, and run lottery-linked nudges for the last group.

3,000
Customers segmented over a six-month window
5
Interpretable segments with pen portraits
4
Source datasets fused to customer level
§ 05 — Turning clusters into decisions

A recommendation per segment.

Statistics don't move a marketing budget — recommendations do. Each cluster got a short statistical summary and a concrete action, so the deliverable read as a plan rather than a plot. That translation step is the part that makes segmentation worth doing.

§ 06 — What I'd do differently

Three things, next time.