Skip to content

About

An end-to-end data analytics project using Python to predict telecom customer churn. Features comprehensive data cleaning, feature engineering, and an optimized Random Forest machine learning model designed to identify at-risk customers and drive proactive retention strategies.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Telco Customer Churn Prediction & Retention Strategy

Project Overview

This project analyzes telecommunications customer data to predict churn and uncover actionable retention strategies. By building and optimizing machine learning models in Python, this analysis identifies the core drivers of customer attrition and provides a predictive framework to flag at-risk customers before they cancel their service.

Business Problem

Customer acquisition is consistently more expensive than retention. In a telecom business model, correctly identifying customers who are likely to leave allows the company to proactively offer targeted incentives and save revenue. Because missing a churner is more costly than accidentally offering a discount to a loyal customer, the primary optimization metric for this project is Recall.

Tech Stack

  • Language: Python
  • Data Manipulation: Pandas, NumPy
  • Machine Learning: Scikit-Learn (Logistic Regression, Random Forest, GridSearchCV)
  • Visualization: Matplotlib, Seaborn

Methodology

  1. Data Cleaning & Preparation:
    • Converted hidden blank spaces in TotalCharges to numeric values and dropped new accounts with zero tenure.
    • Removed non-predictive identifiers (customerID).
  2. Feature Engineering:
    • Mapped the target variable to binary outcomes and applied one-hot encoding to all categorical features, expanding the dataset to 30 predictive features.
    • Standardized all numerical features using StandardScaler to optimize distance-based algorithm calculations.
  3. Baseline Modeling:
    • Trained a Logistic Regression model which achieved an initial recall of 57% for the churn class.
  4. Ensemble Modeling & Hyperparameter Tuning:
    • Deployed a Random Forest Classifier utilizing class_weight='balanced' to handle the inherent 73/27 class imbalance.
    • Executed a robust GridSearchCV pipeline (324 total fits) specifically scoring for recall to find the optimal combination of n_estimators, max_depth, and min_samples_split.

Key Insights & Business Recommendations

  1. Financials & Longevity Dominate: Feature importance extraction revealed that TotalCharges, tenure, and MonthlyCharges heavily dictate flight risk.
    • Recommendation: Focus retention budgets on the early onboarding phase and proactively target highly price-sensitive segments with loyalty discounts.
  2. Contract Lock-in: Month-to-month contracts are significant drivers of customer churn.
    • Recommendation: Design customized upgrade campaigns to incentivize month-to-month users to sign one-year or two-year agreements.
  3. Final Model Performance: The optimized Random Forest successfully identified 79% of actual churners (Recall: 0.79, F1-Score: 0.62). This allows the business to successfully intercept nearly 8 out of 10 at-risk accounts before they finalize their cancellation.

How to Run

  • Clone this repository.
  • Ensure the required libraries are installed (pip install pandas numpy scikit-learn matplotlib seaborn).
  • Run the Jupyter Notebook cell-by-cell to view the end-to-end data pipeline, feature importance visualizations, and classification reports.

About

An end-to-end data analytics project using Python to predict telecom customer churn. Features comprehensive data cleaning, feature engineering, and an optimized Random Forest machine learning model designed to identify at-risk customers and drive proactive retention strategies.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages