Customer churn is a major challenge for subscription-based businesses because losing customers directly reduces recurring revenue. This project uses machine learning to predict customer churn for a telecom subscription business and support retention campaign prioritization.
The goal is not only to classify customers as churn or non-churn, but also to support business decision-making by identifying high-risk customers, tuning the classification threshold, estimating retention value, and recommending targeted retention actions.
The central business question is:
Which customers are most likely to churn, and how can the company prioritize retention actions to reduce revenue loss?
In this project, churn prediction is treated as a business decision-support problem. False negatives are especially important because missing a truly high-risk customer can lead to lost revenue. False positives also matter because unnecessary retention offers create campaign costs.
This project uses the Telco Customer Churn dataset from Kaggle.
Dataset source:
https://www.kaggle.com/datasets/blastchar/telco-customer-churn
The dataset contains customer-level information for a telecom subscription business, including customer demographics, subscribed services, contract type, payment method, monthly charges, total charges, and churn status.
The raw dataset is not included in this repository. See data/README.md for details.
customer-churn-prediction-retention-strategy
├── README.md
├── data
│ └── README.md
├── docs
│ └── project_summary.md
├── images
│ ├── churn_by_contract_type.png
│ ├── churn_by_tenure_group.png
│ ├── final_confusion_matrix.png
│ ├── model_comparison.png
│ └── README.md
├── notebooks
│ └── customer_churn_prediction_retention_strategy.ipynb
├── reports
│ └── customer_churn_project_overview.pdf
└── src
Month-to-month customers showed a much higher churn rate than customers with one-year or two-year contracts.
Customers in the earliest tenure groups showed the highest churn risk, indicating an important early-retention opportunity.
Multiple models were compared using classification and ranking metrics, including recall, F1-score, ROC-AUC, and PR-AUC.
The final model was evaluated at the selected business-aware threshold of 0.40.
- Python
- Pandas
- NumPy
- Matplotlib
- Seaborn
- Scikit-learn
- Jupyter Notebook / Google Colab
- Kaggle dataset access
The project follows a structured machine learning workflow:
- Business problem definition
- Dataset loading and inspection
- Data quality checks
- Data cleaning and target encoding
- Exploratory data analysis
- Feature engineering
- Preprocessing pipeline
- Baseline model development
- Logistic Regression modeling
- Class-weighted Logistic Regression
- Random Forest modeling
- Model comparison
- Business-aware threshold tuning
- Profit-based retention simulation
- Model interpretation
- Business recommendations
The EDA focused on churn rates rather than only raw customer counts. Key churn patterns included:
| Customer Segment | Churn Rate |
|---|---|
| Month-to-month contract customers | 42.71% |
| One-year contract customers | 11.27% |
| Two-year contract customers | 2.83% |
| Customers with 0–6 months tenure | 52.94% |
| Electronic check users | 45.29% |
| Fiber optic customers | 41.89% |
| Customers without OnlineSecurity | 41.77% |
| Customers without TechSupport | 41.64% |
These insights showed that high-risk churn segments include new customers, month-to-month customers, electronic check users, fiber optic customers, customers with higher monthly charges, and customers without key support services.
Several models were compared:
| Model | Accuracy | Precision | Recall | F1-score | ROC-AUC | PR-AUC |
|---|---|---|---|---|---|---|
| Dummy Classifier | 0.7346 | 0.0000 | 0.0000 | 0.0000 | 0.5000 | 0.2654 |
| Logistic Regression | 0.7984 | 0.6502 | 0.5160 | 0.5761 | 0.8451 | 0.6545 |
| Class-Weighted Logistic Regression | 0.7488 | 0.5175 | 0.7888 | 0.6250 | 0.8447 | 0.6544 |
| Random Forest | 0.7722 | 0.5540 | 0.7273 | 0.6289 | 0.8418 | 0.6495 |
The Class-Weighted Logistic Regression model was selected as the main model because it achieved high recall, strong ROC-AUC and PR-AUC, and better interpretability than the Random Forest model.
The default classification threshold of 0.50 was not automatically accepted. Multiple thresholds were tested to evaluate the trade-off between precision, recall, false positives, false negatives, and campaign size.
A profit-based retention simulation was performed using the following assumptions:
| Business Assumption | Value |
|---|---|
| Retention offer cost per targeted customer | 50 |
| Retention success rate | 30% |
| Revenue horizon | 12 months |
The best threshold based on estimated net business value was 0.40.
At threshold 0.40:
| Metric | Value |
|---|---|
| Targeted Customers | 692 |
| True Churners Targeted | 326 |
| Estimated Saved Customers | 97.8 |
| Campaign Cost | 34,600 |
| Potential Retained Revenue | 86,821.02 |
| Net Estimated Value | 52,221.02 |
At the selected threshold of 0.40, the final model achieved:
| Metric | Value |
|---|---|
| Accuracy | 70.62% |
| Precision | 47.11% |
| Recall | 87.17% |
| F1-score | 61.16% |
| ROC-AUC | 84.47% |
| PR-AUC | 65.44% |
Final confusion matrix:
| Predicted No Churn | Predicted Churn | |
|---|---|---|
| Actual No Churn | 669 | 366 |
| Actual Churn | 48 | 326 |
The final model correctly identified 326 out of 374 churned customers in the test set.
The model should be used as a decision-support tool for retention planning.
Recommended high-risk customer groups:
- New customers
- Month-to-month contract customers
- Electronic check users
- Fiber optic customers
- Customers with high monthly charges
- Customers without key support services
Recommended retention actions:
| Customer Segment | Recommended Action |
|---|---|
| New month-to-month customers | Onboarding support and contract upgrade incentive |
| Electronic check users | Automatic payment incentive |
| Customers without support services | Support-service bundle |
| High-charge or fiber optic customers | Price-value review or loyalty offer |
| Other high-risk customers | General retention follow-up |
This project demonstrates how machine learning can support customer retention strategy by:
- identifying customers with high churn risk
- reducing missed churners through recall-focused modeling
- selecting a business-aware classification threshold
- estimating the financial impact of retention campaigns
- translating model results into practical business actions
This project has several limitations:
- Business simulation values are assumptions and should be validated with stakeholders.
- The model was evaluated using a train-test split from the same dataset.
- Some engineered features overlap with original variables.
- Logistic Regression coefficients should be interpreted carefully.
- The model identifies associations, not causal relationships.
- Real-world deployment would require monitoring, retraining, fairness checks, and business validation.
Possible future improvements:
- Validate retention cost and success-rate assumptions with real business data
- Add cross-validation for more robust model evaluation
- Test additional models such as Gradient Boosting, XGBoost, or LightGBM
- Add SHAP-based model interpretation
- Build a customer risk scoring dashboard
- Monitor model performance over time after deployment
notebooks/customer_churn_prediction_retention_strategy.ipynb— full machine learning notebookdocs/project_summary.md— detailed project summaryreports/customer_churn_project_overview.pdf— PDF project overviewdata/README.md— dataset source and usage notes
Mahdi Dadgar
PhD background in Animal Science and Animal Nutrition
Career transition into Data Analytics, Business Intelligence, Data Science, and AI



