Skip to content

EDITH96929/Customer-churn-prediction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

27 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“‘ Telecom Customer Churn Prediction

An End-to-End Data Analytics & Machine Learning Project

Python Power BI ML Status


πŸ“Œ Problem Statement

XYZ Telecom is experiencing a 26.5% annual customer churn rate, resulting in significant revenue loss every quarter. The Customer Success and Revenue Analytics teams require a data-driven early-warning system that:

  • Identifies high-risk customers 60–90 days before churn occurs
  • Segments customers by behavioral and demographic risk profiles
  • Enables targeted retention campaigns by the marketing team
  • Provides explainable predictions that business stakeholders can act on Goal: Reduce customer churn by 8–10% within two quarters through predictive intervention, using machine learning and an interactive Power BI dashboard.

πŸ“ Project Structure

telecom-churn-prediction/
β”‚
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ raw/                  ← Original unmodified dataset (not pushed to Git)
β”‚   β”œβ”€β”€ processed/            ← Cleaned & feature-engineered data
β”‚   └── predictions/          ← Model output scores for Power BI
β”‚
β”œβ”€β”€ notebooks/
β”‚   β”œβ”€β”€ 01_data_profiling.ipynb       ← Initial data understanding
β”‚   β”œβ”€β”€ 02_eda.ipynb                  ← Exploratory Data Analysis
β”‚   β”œβ”€β”€ 03_feature_engineering.ipynb  ← New feature creation
β”‚   β”œβ”€β”€ 04_modeling.ipynb             ← Model building & evaluation
β”‚   └── 05_explainability.ipynb       ← SHAP analysis
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ preprocess.py         ← Data cleaning functions
β”‚   β”œβ”€β”€ features.py           ← Feature engineering pipeline
β”‚   └── model.py              ← Model training & evaluation
β”‚
β”œβ”€β”€ powerbi/
β”‚   └── churn_dashboard.pbix  ← Final Power BI dashboard
β”‚
β”œβ”€β”€ reports/
β”‚   └── business_summary.pdf  ← Non-technical stakeholder report
β”‚
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ .gitignore
└── README.md

πŸ“Š Dataset

Property Detail
Source IBM Telco Customer Churn β€” Kaggle
Rows 7,043 customers
Columns 21 features
Churn Rate 26.54%
Domain Telecommunications

Key Features

Feature Description
customerID Unique customer identifier
tenure Number of months with the company
MonthlyCharges Current monthly bill amount
TotalCharges Total amount charged to date
Contract Contract type (Month-to-month, One year, Two year)
PaymentMethod How the customer pays
InternetService Type of internet service
TechSupport Whether customer has tech support
Churn Target variable β€” Yes / No

πŸ”§ Tech Stack

Data & Engineering

  • Python 3.11 β€” Core language
  • Pandas & NumPy β€” Data manipulation
  • SQL / SQLite β€” Data storage and querying
  • Jupyter Notebook β€” Analysis environment

Machine Learning

  • Scikit-learn β€” Preprocessing, baseline models
  • XGBoost / LightGBM β€” Production-grade gradient boosting
  • Imbalanced-learn β€” SMOTE for handling class imbalance
  • SHAP β€” Model explainability

Visualization & Reporting

  • Matplotlib / Seaborn / Plotly β€” EDA charts
  • Power BI Desktop β€” Stakeholder dashboard

DevOps & Workflow

  • Git & GitHub β€” Version control
  • MLflow β€” Experiment tracking

πŸ—ΊοΈ Project Workflow

Business Problem Definition
        ↓
Data Acquisition (Kaggle)
        ↓
Data Profiling & Quality Check  ← notebook 01
        ↓
Exploratory Data Analysis       ← notebook 02
        ↓
Feature Engineering             ← notebook 03
        ↓
Model Building & Evaluation     ← notebook 04
        ↓
SHAP Explainability             ← notebook 05
        ↓
Power BI Dashboard
        ↓
Business Recommendation Report

πŸ“ˆ Power BI Dashboard Pages

Page Content
Executive Summary Churn rate KPIs, revenue at risk, trend lines
Churn Risk Segmentation CLV vs churn probability scatter, treemap by segment
Behavioral Deep Dive Usage patterns, support tickets, payment failures
Model Predictions Top 500 high-risk customers with churn scores
Retention Tracking Campaign ROI, intervention success rate

⚠️ Real-World Challenges Addressed

Class Imbalance β€” Only 26.5% of customers churn. Handled using SMOTE oversampling and evaluated using AUC-ROC and F1-score instead of raw accuracy.

Hidden Data Quality Issues β€” TotalCharges column stored as string type despite being numerical, containing 11 hidden null values missed by standard checks.

Feature Engineering β€” Raw columns alone are insufficient. New features created include usage trends, support ticket frequency, and price sensitivity scores.

Temporal Validation β€” Data split by time (not randomly) to simulate real production model validation.

Business Explainability β€” SHAP values used to explain every prediction in plain business language, not just model scores.


πŸš€ How to Run This Project

1. Clone the repository

git clone https://github.com/YOUR_USERNAME/telecom-churn-prediction.git
cd telecom-churn-prediction

2. Create virtual environment

python -m venv venv
venv\Scripts\activate       # Windows
source venv/bin/activate    # Mac/Linux

3. Install dependencies

pip install -r requirements.txt

4. Add the dataset

Download WA_Fn-UseC_-Telco-Customer-Churn.csv from Kaggle and place it in data/raw/.

5. Run notebooks in order

jupyter notebook

Open and run notebooks 01 β†’ 02 β†’ 03 β†’ 04 β†’ 05 in sequence.


πŸ“‹ Key Results (updated as project progresses)

Metric Value
Baseline Churn Rate 26.54%
Best Model TBD
AUC-ROC Score TBD
F1 Score TBD
High-Risk Customers Identified TBD
Estimated Revenue at Risk TBD

πŸ’Ό Business Recommendations (updated after modeling)

This section will contain non-technical findings written for business stakeholders β€” segment-wise risk breakdown, recommended retention actions, and estimated ROI of intervention.


πŸ‘€ Author

Sunil β€” Aspiring Data Analyst
Building real-world projects to work at top companies.

πŸ“¬ GitHub Β· LinkedIn


πŸ“„ License

This project is open source and available under the MIT License.

About

Customer churn directly impacts revenue and increases customer acquisition costs. The goal of this project is to analyze historical customer data to answer three critical business questions:

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors