Customer Churn Prediction & Segmentation

2 min read
Churn Predictor App

Telecom companies lose billions annually to customer churn - and identifying at-risk customers before they leave is one of the highest-value problems in the industry. This project builds a complete ML pipeline that combines unsupervised customer segmentation (clustering customers by behaviour) with supervised churn prediction (classifying which customers will leave). The best-performing model - a TensorFlow Artificial Neural Network - achieved 93% accuracy and 99% precision on the churn class, meaning when it flags a customer as at risk, it is almost never wrong. The model is served through a Gradio web interface, containerised with Docker, and deployed live on Google Cloud Run.

🎯 The Challenge

Telecom businesses struggle to act on churn risk proactively because traditional reporting tools only show who has already left - not who is about to leave. There was no predictive, interactive tool that a non-technical stakeholder could use to input a customer's profile and instantly get a churn risk assessment. The challenge was to build a production-ready ML solution that was both accurate enough to trust and accessible enough to actually use.

⚙️ The Action

  • Performed exploratory data analysis to understand feature distributions, class balance, and correlations across the dataset of 88,000+ customer records.
  • Selected 5 high-signal, leakage-free features aligned with the RFM framework: Total Spend, Usage Frequency, Payment Delay, Support Calls, Last Interaction
  • Applied K-Means clustering to segment customers into behavioural groups, profiling each cluster for targeted retention strategy.
  • Trained and compared multiple models: Logistic Regression (baseline), Random Forest, Gradient Boosting, and a TensorFlow/Keras ANN.
  • Tuned the ANN architecture and validated results on a held-out test set of 88,167 samples.
  • Built an interactive Gradio app allowing users to input customer attributes and receive a real-time churn prediction.
  • Containerised the app with Docker (python:3.11-slim) and deployed to Google Cloud Run for scalable serverless access.

📊 The Impact

  • 93% overall accuracy on 88,167 unseen test samples.
  • 99% precision on the churn class - near-zero false positives when predicting churners, enabling confident, targeted retention spend.
  • F1-Score: 0.93 (macro average) - balanced performance across both churn and non-churn classes.
  • Live production app accessible to any stakeholder at any time, requiring zero technical knowledge to use.
  • Identified distinct customer segments, enabling differentiated retention strategies (e.g. loyalty offers for high-value at-risk customers vs re-engagement campaigns for dormant users).

Technologies Used

pythonpandasnumpyplotlyGradioDockerCloud Run