k-Means Clustering Explorer

Segmentation tool Exploratory

Which customers behave alike — and what makes each group distinct? Upload numeric marketing data (CRM metrics, campaign responses, survey scores), choose how many segments to look for, and discover natural clusters that can drive targeting, positioning, and resource allocation.

👨‍🏫 Professor Mode: Guided Learning Experience

New to cluster analysis? Enable Professor Mode for step-by-step guidance through segmenting your customers with K-Means clustering!

OVERVIEW & WHAT THIS TOOL SOLVES

Sending the same generic promotion to your entire customer list wastes budget when your audience actually consists of distinct behavioral groups—like high-spend loyalists, seasonal bargain hunters, and lapsing one-time buyers. K-Means Clustering automatically partitions customers, products, or stores into k distinct segments based on numeric behavioral metrics (such as Recency, Frequency, and Monetary value) so that members within each segment are as similar as possible and segments are maximally distinct.

🎯 Questions It Answers

  • What natural customer personas or behavioral segments exist inside our CRM or survey metrics?
  • How many segments (k) best balance statistical cohesion with actionable marketing simplicity?
  • What are the defining behavioral averages (centroids) that distinguish Segment 1 from Segment 2?

📂 What Data You Need

  • Entity-Level CSV: One row per customer, store, SKU, or respondent.
  • 2+ Continuous Numeric Columns: Behavioral or attitudinal metrics (e.g., annual spend, order frequency, days since last visit, satisfaction score).
  • Standardization Toggle: Recommended (and built-in) when variables are measured in different units (e.g., dollars vs. visits).

💡 What You'll Discover

  • Elbow & Silhouette Diagnostics: Visual guides showing where adding more clusters stops improving compactness and separation.
  • Cluster Centroid Profiles: Mean profiles on both original and standardized scales to name and target each persona.
  • Segment-Tagged Export: Downloadable customer table with assigned cluster IDs and distances to each cluster center.
🔍 Key Nuances & Common Traps to Watch For
  • Why Feature Scaling Is Critical: K-Means measures straight-line Euclidean distance. Without standardization, a variable measured in thousands of dollars (e.g., Annual Spend) will completely drown out a variable measured on a 1–7 scale (e.g., Satisfaction). Standardizing to z-scores gives every metric an equal voice.
  • Choosing k Is Part Math, Part Strategy: Use the Elbow Plot (Within-Cluster Sum of Squares) and Silhouette Score to narrow the range, then pick the solution whose personas your marketing team can actually execute against.
  • Numeric Only vs. Mixed Data: Standard K-Means requires numeric columns. If you need to cluster on both numeric spend and categorical attributes (like region or plan tier), use the k-Prototypes Clustering tool.
📐 Under the Hood: Model Equations & Variable Definitions
1. K-Means Within-Cluster Sum of Squares (WCSS) Objective & Silhouette Score
\[ \min_{\{C_1, \dots, C_k\},\, \{\boldsymbol{\mu}_1, \dots, \boldsymbol{\mu}_k\}} \;\sum_{j=1}^{k} \sum_{\mathbf{x}_i \in C_j} \lVert \mathbf{x}_i - \boldsymbol{\mu}_j \rVert^2, \qquad s(i) = \frac{b(i) - a(i)}{\max\{a(i),\, b(i)\}} \]
💬 Read it in plain English: K-Means alternates between assigning each customer (xi) to the nearest cluster center (μj) and updating each center to the average of its members until total squared distance inside clusters is minimized; the Silhouette Score s(i) checks how tightly each customer fits their own cluster relative to the next-nearest cluster.
xi
Customer Feature Vector YOUR DATA ⓘ
Vector of numeric behavioral or survey measurements for observation i.
k, Cj
Number of Clusters & Cluster Set OUTPUT ⓘ
Total number of segments (k) and the set of customers assigned to cluster j (Cj).
μj
Cluster Centroid (Mean Vector) ESTIMATED ⓘ
Center of cluster j, representing the average profile of all customers in that segment across every feature.
s(i), a(i), b(i)
Silhouette Coefficient & Cohesion/Separation INFERENCE ⓘ
Compares average distance to own-cluster members a(i) against average distance to the nearest neighboring cluster b(i).

DATA SOURCE

📚

Use a Case Study

Use presets to load example segmentation datasets (such as customers with RFM metrics, email campaign performance, or product portfolio data). You can download the scenario data to tweak it in Excel or Numbers and then re-upload.

📤

Upload Your Data

Upload numeric CSV data

Provide a header row and numeric columns only (up to 5,000 observations). After upload you can choose which variables to include in the clustering and which to plot on the chart.

Drag & Drop CSV file (.csv, .tsv, .txt, .xls, .xlsx)

Include headers with numeric columns for clustering analysis.

No file uploaded.

INPUTS & SETTINGS

Feature selection

Choose which numeric columns are used to form clusters. The mini chart beside each name shows how that variable is distributed.

No data loaded.

Preprocessing & clustering

to
Advanced settings
Additional info & guidance

Start with a small range of clusters (for example, 2–8) and look at the elbow and silhouette charts to decide on a reasonable value of k. Extremely large k can overfit noise and create tiny clusters that are hard to interpret.

You can change the standardization option to see how feature scaling impacts cluster assignments, which is especially important when some variables are on very different scales (for example, annual revenue vs. satisfaction scores).

VISUAL OUTPUT

Cluster map (scatterplot)

Each point is an observation colored by cluster membership, plotted using the selected x and y variables. Centroids are shown as larger markers. The underlying clustering uses all selected features (after any chosen scaling), but the axes on this chart always show the variables in their original units. This means the map is a 2D or 3D projection: clusters that overlap visually on these axes may still differ on other variables included in the model.

Elbow chart (within-cluster variation)

Plots total within-cluster sum of squares (WCSS) versus k. Look for an “elbow” where additional clusters give diminishing returns.

Advanced visualization settings

Subsampling can make dense plots easier to read when you have many observations. When you show only a random subset of points, the clusters and centroids are still based on the full dataset.

Silhouette diagnostics

Shows the average silhouette score for the current choice of k. Silhouette values range from -1 to 1: values near 1 indicate observations are much closer to their own cluster than to others (clear, well-separated segments), values near 0 indicate overlapping or ambiguous boundaries, and negative values suggest some observations fit better in a different cluster.

CLUSTER SUMMARY

Number of clusters (k): –
Total within-cluster SS: –
Average silhouette (k): –
Largest cluster size: –

APA-Style Report

After you run k-means, this panel will describe the clustering solution in a more formal statistical style, including the number of clusters, within-cluster variation, and basic diagnostics.

Managerial Interpretation

This panel translates the clustering into plain language, highlighting how many customer or campaign segments were found, how they differ on key variables, and how actionable the segments appear.

Cluster Profile Views

These tabs show the same cluster solution through different lenses: exact values, shape, contrast, over/under-indexing, and overlap. Start with the profile table, then switch views to see what becomes easier to spot visually.

Show values in: Run clustering to compare the two.

Use the table when you want exact values for size, average feature levels, within-cluster variability, and overall tightness.

Cluster Size Feature means Within-cluster standard deviations Avg distance to centroid
Run clustering to see cluster profiles here.

The downloaded file includes all of your original columns (including any ID or label columns, such as customer_id or name) plus a cluster_id for each observation and its distance_to_centroid (how far it sits from the center of its assigned cluster, in the original units of the selected features). This lets you join the segments back to your records.

DIAGNOSTICS & ASSUMPTIONS

Diagnostics & assumptions

The tool flags weak or absent separation (low silhouette), segments that change when the algorithm restarts from a different random start, very small segments (under 5% of cases), and inputs left on different scales. It does not check for outliers directly, so look at the cluster profiles and sizes yourself: a tiny cluster sitting far from the rest is often a handful of extreme cases. Use these diagnostics to decide whether to simplify the feature set, change k, or reconsider using k-means for this dataset.

APPLY THE SEGMENTS TO A HOLDOUT SAMPLE

A segmentation is only useful if you can place a customer the model has never seen. Upload a second file — rows held back, next month’s customers, a different region — and each row is assigned to its nearest centroid from the run above.

The holdout is scaled with the training means and standard deviations, never with its own. Re-standardizing a new file on its own average would quietly move every centroid and produce confident, wrong assignments. Distances below are measured in that same scaled space, because that is the space the assignment rule actually uses.

Drag & Drop a holdout CSV (.csv, .tsv, .txt)

It must contain the same feature columns you clustered on. Any other columns are carried through to the download untouched.

Run clustering first, then upload a holdout file here.