Telecom Customer Segmentation

A practical segmentation system for Tunisia Telecom that starts before clustering and continues after it: define what each row means, make the feature space usable, discover and profile behavioral groups, then translate them into understandable monthly assignment rules.

174 candidate features 49 retained features ~1,000 K-means centroids Monthly rule-based assignment

The central idea: A clustering algorithm cannot rescue a poorly designed representation. This project treats segmentation as a sequence of decisions: representation, feature geometry, structure discovery, business validation, and assignment.

One system, two connected phases

The first phase discovers behavioral segments from history. The second learns how to assign subscribers when their histories are shorter and the discovery pipeline is not something to rerun for every new customer.

Telecom customer segmentation architecture showing behavioral data, observation-unit choice, feature preparation, structure discovery, iterative profiling, and business-usable segments
The project overview at a glance: define the observation, shape the features, explore structure, profile and redesign, and validate business-usable segments.
  1. Define the observationCustomer profile or customer-month behavioral state?
  2. Prepare the feature spaceReview zeros, extremes, skew, transformations, and scale.
  3. Reduce the clustering scaleSummarize a large population as representative centroids.
  4. Explore hierarchyApply Ward clustering to the compressed representation.
  5. Profile and redesignKeep segments that remain coherent and useful to CVM.
  6. Make segments assignableExtract interpretable rules for recurring scoring.

Project at a glance

Built for Customer Value Management (CVM) at Tunisia Telecom, this work connects unsupervised discovery to supervised monthly assignment. It addresses the full modeling path rather than treating clustering as a standalone algorithm choice.

The public architecture illustrates actionable segment families including Young Prepaid, Data Addicts, High Consumers, Fragile Users, and Multi-SIM / Household. These names express the intended business vocabulary; each segment still needs to be justified by its profile.

The Four Core Design Problems

1. Observation Unit Design: Customers vs. Behavioral States

With monthly behavioral history per subscriber, the first question was: does one row represent a customer (collapsed over time) or a behavioral state (one row per subscriber-month)? Approach A produces stable long-term customer typologies — useful for structural CVM strategy. Approach B reveals behavioral transitions — useful for early warning signals and lifecycle modeling. The choice was made based on the specific CVM use case, not on what was computationally easier.

Comparison of one subscriber per row with one subscriber-month per row
Customer-level averages answer “who is this customer on average?”; monthly snapshots answer “what state is this customer in now?”
/* Representation sketch — choose the key that matches the question */
customer_profile = aggregate(history, by=subscriber_id)
behavioral_state = retain_snapshots(history, by=subscriber_id_and_month)

2. Variable Clusterability Before Redundancy Removal

The raw feature space had extreme skewness — some variables with skewness above 40, kurtosis above 1000. Standard scaling alone would make the distance geometry unstable. Before any correlation-based feature removal, every variable was tested for clusterability and assigned a transformation such as log, square root, or a power transform where justified. Variables that could not be stabilized by a suitable transformation were removed — not because they were redundant, but because they were unusable in a distance space.

174 → 49

A smaller, reviewed feature set

The project overview reports 174 candidate variables reduced to 49 retained features. The important point is that feature preparation and variable reduction came before trusting the clustering distances.

/* Variable-specific transformation assignments */
recharge_amount:      power_transform → (max(value,0) / scale) ^ 0.25
avg_call_duration:    log_transform   → log(max(value,0) / scale + 1)
active_days_ratio:    sqrt_transform  → sqrt(max(value,0) / scale)
total_data_volume:    power_transform → (max(value,0) / scale) ^ 0.25

/* Project summary: 174 candidates → 49 retained features */
Feature-space diagram showing skewed and zero-heavy inputs, a review and transformation stage, and a more usable distance space
Transform each variable with its distribution and meaning in mind. Standardization aligns scales; it does not solve every shape problem.

3. K-means Compression Before Hierarchical Clustering

With hundreds of thousands of subscribers, hierarchical clustering cannot run directly (quadratic complexity). But K-means alone flattens nested structure. The solution: use K-means as a compression layer first (compressing to ~1000 representative centroids), then run Ward's hierarchical method on those centroids. K-means acts as a reducer, not the final segmenter — the dendrogram helps compare candidate structures, which are then reviewed through their business profiles.

/* Stage 1: K-means compression */
proc fastclus data=normalized_features
    maxclusters=1000
    out=compressed_centroids;
  var feature_1 - feature_49;
run;

/* Stage 2: Hierarchical clustering on centroids */
proc cluster data=compressed_centroids
    method=ward
    outtree=dendrogram;
  var feature_1 - feature_49;
run;

/* Select the hierarchical cut after reviewing the
   dendrogram and profiling candidate segments. */
Large behavioral table compressed into K-means centroids before Ward hierarchical structure is explored
K-means is the compression layer; Ward is used to explore higher-level structure among the centroids.

4. Supervised Rule-Based Assignment for Production

A subscriber who activated last month has only 1–2 months of history. The unsupervised model was built on a longer behavioral window — it cannot score new customers. The supervised phase bridges this gap: use existing cluster memberships as a target label, augment across multiple months, train a decision tree, extract rules, round thresholds with CVM teams, and deploy as a monthly scoring system. The model that assigns is not the model that discovered.

Tree splits are translated into readable conditions and thresholds are reviewed with CVM stakeholders. Exact production thresholds are intentionally not exposed in the public project. The operational goal is a stable, understandable assignment—not a perfect reproduction of every unsupervised boundary.

Iterative Profiling Dimensions

Profiling was part of each iteration, not a final presentation step. Segments that could not be described clearly across relevant dimensions prompted a review of the representation and feature set:

  • Recharge behavior: frequency, regularity, weekend patterns, top-up value distribution
  • Voice vs. data mix: usage intensity by service, on-net vs. off-net split
  • Handset quality: 2G/3G/4G device capability, device change frequency
  • Network community: graph degree, community size, operator mix in social group
  • Region and mobility: geographic footprint, distinct cell towers visited
  • CVM response: campaign sensitivity, offer activation behavior
  • Churn signals: inactivity days, declining usage trends, recharge evaporation

Key Takeaway

Useful segments did not emerge from running one clustering method once. The final segmentation came from repeated cycles of representation, clustering, profiling, and redesign. Unlike supervised learning, there is no target variable to tell you whether the representation is right — iteration is not optional, it is the method.

Design insight: In distance-based unsupervised learning, bad variable shape is a bigger problem than variable redundancy. And the question "which clustering method?" must come after "are all these variables even representable in a shared distance space?"

Where this pattern generalizes

The same design questions arise in banking customers with monthly transaction states, e-commerce lifecycle behavior, subscription engagement, and IoT devices with changing operating states. Whenever behavior changes over time and segments must become assignable, the observation unit and the operational bridge are part of the modeling problem.

The public repository shares the architecture, methodological framing, selected pseudocode, and project presentation. Raw telecom data, confidential schemas, and production identifiers are not included.

FAQ

What is the key takeaway from "Telecom Customer Segmentation"?

Segmentation is a system, not a single clustering call: define what each row represents, prepare variables for distance-based methods, profile and refine clusters, then make the segments assignable with interpretable rules.

Who wrote this and what is it about?

Mahmoud Trigui built a telecom CVM segmentation workflow covering observation-unit design, feature preparation from 174 candidate variables to 49 retained features, K-means compression to about 1,000 centroids, Ward hierarchical clustering, iterative profiling, and supervised rule-based monthly assignment. Raw telecom data, confidential schemas, and production identifiers are not public.

Comments

ForecastingTime SeriesMachine LearningPredictive ModelingFeature EngineeringNLPLLM ApplicationsDocument AICustomer SegmentationTelecom AnalyticsAnomaly DetectionRecommendation SystemsGraph AnalyticsGeospatial AnalyticsStatistical AnalysisExperimentation & A/B TestingPythonRSQLDataikuShiny DashboardsStreamlit AppsData VisualizationProduction MLModel EvaluationDecision SystemsData AutomationBusiness Analytics