Skip to content

Repository files navigation

📉 Customer Churn Prediction

An end-to-end machine learning project that performs EDA, compares multiple models (Logistic Regression, Random Forest, XGBoost), tunes hyperparameters, and deploys a real-time churn prediction app using Streamlit — achieving 86% ROC-AUC on the IBM Telco dataset.

🔗 Live Demo: customer-churn-prediction-pranjal-pandey-003.streamlit.app


📌 Project Overview

Customer churn is one of the biggest challenges in the telecom industry. This project builds a predictive ML pipeline that identifies at-risk customers based on their demographics, services, and billing information — helping businesses take proactive retention measures.


🚀 Features

  • Predicts churn probability in real-time
  • Interactive UI with dropdowns and sliders for all customer attributes
  • Risk level categorization: 🔴 High / 🟡 Medium / 🟢 Low
  • XGBoost model trained with class imbalance handling
  • Model trains on startup — no pickle version issues

🛠️ Tech Stack

Layer Tools
ML Model XGBoost, Scikit-learn
Data Processing Pandas, NumPy
Frontend Streamlit
Deployment Streamlit Cloud
Version Control Git, GitHub

📊 Models Compared

Model ROC AUC F1 Score Recall
Logistic Regression 0.86 0.64 0.84
Random Forest (Tuned) 0.85 0.65 0.78
XGBoost 0.86 0.65 0.80

XGBoost selected as final model for best overall balance of precision, recall and AUC.


📂 Project Structure

Customer-Churn-Prediction/
├── app.py                        # Streamlit frontend + model training
├── requirements.txt              # Dependencies
├── Telco_Customer_Churn.csv      # Dataset (IBM Telco)
├── Customer_Churn_Prediction.ipynb  # EDA + model experiments
└── .gitignore

📥 Input Features

Demographics: Gender, Senior Citizen, Partner, Dependents

Services: Phone Service, Multiple Lines, Internet Service, Online Security, Online Backup, Device Protection, Tech Support, Streaming TV, Streaming Movies

Billing: Contract Type, Paperless Billing, Payment Method, Monthly Charges, Total Charges, Tenure


⚙️ Run Locally

# Clone the repo
git clone https://github.com/venom312004/Customer-Churn-Prediction.git
cd Customer-Churn-Prediction

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

# Install dependencies
pip install -r requirements.txt

# Run the app
streamlit run app.py

📈 Dataset

IBM Telco Customer Churn Dataset

  • 7,043 customers
  • 21 features
  • Target: Churn (Yes/No)
  • Class imbalance handled via scale_pos_weight in XGBoost

👤 Author

Pranjal Pandey

  • GitHub: @venom312004
  • B.Tech Data Science & AI | GGSIPU Delhi

About

Predicts telecom customer churn in real-time using XGBoost with 86% ROC-AUC | Features EDA, model comparison (LR vs RF vs XGBoost), threshold tuning & interactive Streamlit UI | Deployed on Streamlit Cloud

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages