Skip to content

Subakkumar/churn-prediction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Customer Churn Prediction

An end-to-end ML project that predicts customer churn probability using classification models. Trains and compares four models (Logistic Regression, Random Forest, Gradient Boosting, XGBoost), selects the best performer, and serves predictions through an interactive Flask dashboard.

Features

  • Trains 4 ML models and picks the best by ROC-AUC
  • 5-fold cross-validation for reliable evaluation
  • Feature importance visualization
  • ROC curve comparison across all models
  • Interactive churn prediction for any customer profile
  • At-risk customer table with adjustable threshold slider
  • Segment analysis by tenure and login frequency

Tech Stack

  • ML: scikit-learn, XGBoost
  • Backend: Python, Flask
  • Visualization: Matplotlib, Chart.js
  • Data: Synthetic dataset — 5,000 customers with realistic churn patterns

Setup

  1. Clone the repo
  2. python -m venv venv then activate
  3. pip install -r requirements.txt
  4. python data_generator.py — generate dataset
  5. python train_model.py — train models + save plots
  6. python app.py — start dashboard
  7. Open http://localhost:5006

ML Pipeline

  1. Generate synthetic customer data with realistic churn logic
  2. Feature engineering — encode categoricals, scale numerics
  3. Train/test split (80/20) with stratification
  4. Train 4 classifiers with 5-fold CV
  5. Select best model by ROC-AUC
  6. Save model with joblib for serving
  7. Flask API serves predictions in real time

Screenshots

Screenshot 2026-04-30 085814

About

Customer churn prediction using XGBoost, Random Forest, Gradient Boosting — AUC 0.9879, interactive Flask dashboard

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors