Skip to content

coding-for-it/Customer-Churn-Prediction

Repository files navigation

📉 Customer Churn Prediction

A machine learning solution to predict if a customer is likely to churn based on behavior and account features.

🚀 Tech Stack

  • Python
  • Pandas, NumPy, Scikit-learn
  • Matplotlib, Seaborn
  • Streamlit
  • Docker

📁 Project Directory Structure

Customer-Churn-Prediction/
├── data/                  # Raw and processed datasets
│   └── customer_churn.csv
│
├── notebooks/             # Jupyter notebooks for EDA and model pipeline
│   └── churn_pipeline.ipynb
│
├── backend/               # Model and utility scripts
│   ├── model_utils.py
│   └── __init__.py
│
├── database/              # MySQL integration
│   ├── mysql_utils.py
│   └── mysql_setup.sql
│
├── frontend/              # Streamlit web app
│   └── app.py
│
├── .gitignore             # Ignore unnecessary files and folders
├── README.md              # Project overview and instructions
└── requirements.txt       # Python dependencies

📊 Data Source

The dataset contains features like:

  • Customer tenure
  • Contract type
  • Monthly charges
  • Total charges
  • Internet service
  • Payment method
  • Gender, Senior citizen, etc.

🧠 Model Details

  • Model Used: Random Forest Classifier
  • Why Random Forest: Handles both numerical and categorical features well, reduces overfitting, and provides feature importance for interpretability.
  • Evaluation Metrics: Accuracy, Precision, Recall, F1-score, Confusion Matrix.

🧪 How to Run Locally

  1. Clone the Repository
git clone https://github.com/coding-for-it/Customer-Churn-Prediction.git
cd Customer-Churn-Prediction
  1. Create Virtual Environment
python -m venv venv
venv\Scripts\activate  # On Windows
  1. Install Dependencies
pip install -r requirements.txt
  1. Run the App
streamlit run frontend/app.py
  1. Run the FastAPI server
uvicorn backend.api.fastapi_app:app --reload

About

To identify customers who are likely to leave a business,so that the company can take action to retain them.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published