Back to the 2026 paper

Module 4: Cluster Analysis

202614m

Design a clustering framework for identifying customer segments using a large multidimensional dataset. Discuss preprocessing, feature selection, choice of clustering algorithm, selection of the number of clusters, outlier handling and cluster validation.

Worked SolutionAI Assisted

Clustering Framework for Customer Segmentation

Goal: group customers with similar behaviour so that marketing, pricing and service can be targeted per segment. Clustering is unsupervised: there are no predefined labels.

Framework overview

Business goal -> Data collection -> Preprocessing -> Feature selection
   -> Choose algorithm -> Choose number of clusters -> Handle outliers
   -> Validate clusters -> Profile segments and act

1. Data and business goal

Define what "similar" means. Typical features: RFM (recency, frequency, monetary value), age, income, location, product categories, web and app activity, tenure.

2. Preprocessing

  • Missing values: impute (median/mode) or drop sparse columns.
  • Duplicates and inconsistencies: merge and standardize.
  • Categorical features: one-hot or label encoding (or use a distance made for mixed data).
  • Scaling: min-max or z-score, so large-range attributes (income) do not dominate distance.
  • Skewed features: log-transform spending data.

3. Feature selection and dimensionality reduction

In high-dimensional data, distances become less meaningful (curse of dimensionality).

  • Remove irrelevant and highly correlated features (correlation filter, variance threshold).
  • Use PCA to compress correlated features into fewer components.
  • Keep features that are meaningful to the business.

4. Choice of clustering algorithm

Algorithm Best when Limitation
K-means Large data, roughly spherical clusters, numeric features Needs k; sensitive to outliers
Hierarchical Smaller data, want a dendrogram Costly for large data
DBSCAN Arbitrary shapes, noise present, k unknown Struggles with varying densities
Gaussian mixture (model-based) Overlapping segments, soft membership Assumes distribution form
K-prototypes / K-medoids Mixed numeric and categorical data Slower

For a large customer dataset, K-means (or mini-batch K-means) is a good start; DBSCAN or GMM can be used to compare.

5. Selecting the number of clusters

  • Elbow method: plot within-cluster sum of squares (WCSS) against k and pick the bend.
  • Silhouette score: choose the k with the highest average silhouette.
  • Gap statistic, or dendrogram cut for hierarchical clustering.
  • Business usefulness: the segments must be few enough to act on (often 3 to 8).

6. Outlier handling

Outliers pull centroids and distort K-means.

  • Detect with IQR, z-score, Local Outlier Factor or DBSCAN noise points.
  • Decide: remove or cap them if they are errors; keep them as a separate group if they are genuine (very high-value customers or fraud).

7. Cluster validation

Type Measure
Internal (no labels) Silhouette coefficient (higher is better), Davies-Bouldin index (lower is better), Calinski-Harabasz index (higher is better)
External (if labels exist) Adjusted Rand Index, purity
Stability Re-run with different seeds or samples; clusters should stay similar
Business validation Segments are distinct, interpretable and actionable

8. Interpretation and use

Profile each cluster by its mean feature values, for example high-value loyal, new customers, discount seekers, at risk of churn, and design offers for each. Monitor and re-cluster periodically as behaviour changes.

Conclusion

A good segmentation framework combines careful preprocessing, sensible feature selection, a suitable algorithm, a justified k, robust outlier handling and validation, ending in segments the business can act on.

Similar questions

AI LearningWeb Platform

Coursify — Personal AI Course Generator

Struggling with a difficult subject or concept? Turn any engineering topic into a structured course with interactive lessons, quizzes, and research-backed explanations.