Skip to content

Repository files navigation

๐Ÿ” Customer Churn Prediction using Machine Learning

Python Machine Learning Status


๐Ÿ“Œ Project Overview

Customer churn is one of the most critical challenges faced by subscription-based businesses.
This project focuses on predicting customer churn using multiple machine learning classification algorithms, helping businesses identify at-risk customers early and take proactive retention actions.

๐Ÿ”น The project includes data preprocessing, exploratory data analysis, model training, evaluation, and comparison of multiple ML algorithms to select the best-performing model.

๐Ÿ”— GitHub Repo: Link

๐ŸŒ Live Demo: Link


๐ŸŽฏ Objectives

  • ๐Ÿ” Analyze customer behavior data
  • ๐Ÿค– Train and compare multiple ML classification models
  • ๐Ÿ“Š Evaluate models using Accuracy, Precision, Recall & F1-score
  • ๐Ÿ† Select the best-performing model for churn prediction
  • ๐Ÿš€ Prepare the project for real-world deployment (Streamlit-ready)

๐Ÿง  Machine Learning Algorithms Used

  • Logistic Regression
  • Decision Tree Classifier
  • K-Nearest Neighbors (KNN)
  • Support Vector Machine (SVM)
  • Naive Bayes
  • Random Forest Classifier
  • AdaBoost Classifier
  • Gradient Boosting Classifier

๐Ÿ“Š Model Evaluation Metrics

Each model is evaluated using:

  • โœ… Accuracy
  • ๐ŸŽฏ Precision
  • ๐Ÿ” Recall
  • ๐Ÿ“ˆ F1-Score

A comparative performance table is generated to identify the best model.


๐Ÿ† Final Outcome

โœ… XGBoost Classifier (trained separately) was identified as the best-performing model, delivering superior performance across all evaluation metrics.

๐Ÿ“Œ PCA was also tested, but no significant improvement in performance was observed.


๐Ÿ“ Project Structure

Customer-Churn-Prediction/
โ”‚
โ”œโ”€โ”€ Customer Churn Prediction.ipynb   # Model training & analysis
โ”œโ”€โ”€ app.py                            # Streamlit web application
โ”œโ”€โ”€ customer_churn_classifier.pkl     # Trained ML model
โ”œโ”€โ”€ customer_churn_large_dataset.xlsx # Dataset
โ”œโ”€โ”€ README.md                         # Project documentation
โ”œโ”€โ”€ requirements.txt                  # Python dependencies
โ”œโ”€โ”€ .gitignore                        # Ignored files
โ””โ”€โ”€ venv/                             # Virtual environment (ignored)


โš™๏ธ Tech Stack & Tools

  • ๐Ÿ Python
  • ๐Ÿ“Š Pandas, NumPy
  • ๐Ÿค– Scikit-learn
  • ๐Ÿ“‰ Matplotlib, Seaborn
  • ๐ŸŒ Streamlit
  • ๐Ÿ“’ Jupyter Notebook

๐Ÿš€ How to Run the Project

# Clone the repository
git clone https://github.com/your-username/customer-churn-prediction.git

# Navigate to project folder
cd customer-churn-prediction

# Install dependencies
pip install -r requirements.txt

# Open Jupyter Notebook
jupyter notebook

๐Ÿ–ฅ๏ธ Run Streamlit Web App

Run the Streamlit application

streamlit run app.py

Once the app starts, open the browser and visit: ๐Ÿ‘‰ http://localhost:8501/


The web app allows:

  • ๐Ÿ“Š Viewing data insights
  • ๐Ÿค– Understanding model performance
  • ๐Ÿ”ฎ Predicting customer churn in real time

๐ŸŒ Deployment

This project includes a Streamlit-based web application and is ready for deployment on:

  • Streamlit Cloud
  • Localhost
  • Any cloud VM (AWS / Azure / GCP)

The trained model (.pkl) is loaded directly into the app for real-time predictions.

๐Ÿ“Œ Key Learnings

  • End-to-end ML pipeline development
  • Handling categorical & numerical data
  • Model comparison & evaluation
  • Overfitting analysis
  • Real-world ML project structuring

๐Ÿ“„ License

This project is licensed under the MIT License.


๐Ÿ‘จโ€๐Ÿ’ป Author

Piyush Kumar
๐Ÿš€ Data Science & Machine Learning Developer

๐Ÿ“ฌ Let's Connect

๐ŸŒ Portfolio ย โ€ขย  ๐Ÿ’ป GitHub ย โ€ขย  ๐Ÿ’ผ LinkedIn ย โ€ขย  ๐Ÿ“ง Email

Contributors

Languages