Giter VIP home page Giter VIP logo

customer-churn-project's Introduction

Telco Customer Churn Project

This project is a machine learning project focusing on customer churn prediction. The project consists of 4 main steps:

  • Data Preprocessing and Model Development (CatBoost)
  • Interface (Streamlit)
  • API (FastAPI)
  • Automation (Docker)

(You can also take a look at the Medium article that hosts all the processes of the project)

Project Folder Structure

Telco Customer Churn Project/
│
├── data/
│   ├── churn_data_regulated.parquet
│   ├── WA_Fn-UseC_-Telco-Customer-Churn.csv
│   ├── ...
│
├── model/
│   └── cat_model.cbm
│
├── notebooks/
│   ├── telco-customer-churn-eda.ipynb
│   ├── telco-catboost-xgboost-shap-lime.ipynb
│
├── src/
│   ├── fast-api.py
│   ├── predict.py
│   ├── streamlit-app.py
│   └── train_model.py
│
└── Dockerfile
└── requirements.txt

Project Files

  • data/: Contains the data files used for the project.
  • model/: Contains the trained model file.
  • notebooks/: Includes Jupyter Notebooks used for data analysis and model development.
  • src/: Contains the source code of the project. Model training, prediction and service/application development are located in this folder.

Steps

  1. Data Preprocessing and Model Development: Using the script train_model.py, Telco Customer data is preprocessed and a machine learning model is created using the CatBoost model.
  2. Interface: Using the model, the streamlit-app.py script allows the user to enter new customer information and based on this information the churn probability is estimated. Furthermore, the overall SHAP graph of the model and the specific SHAP graph of the selected customer are shown.
  3. API: The fast-api.py script creates an API using the model created with train_model.py. This API takes customer data and returns the churn probability.
  4. Automation: Using Docker, the project is containerized and made executable through the predict.py script. This script takes customer data and calculates the churn probability.

Usage

  1. Clone the project
git clone https://github.com/rolmez/Customer-Churn-Project.git
  1. Go to the project directory
cd Customer-Churn-Project
  1. Install dependencies
pip install requirements.txt
  1. Go to the src directory
cd src
  • For train model
python train_model.py
  • For Streamlit app
streamlit run streamlit-app.py
  • For API
python fast-api.py
  • For predict
python predict.py

or Docker

  1. Run the following command to create the Docker container in the project's home folder:
  docker build -t telco-churn .
  1. Run the following command to start the Docker container:
  docker run -it telco-churn

Some images from the project

Streamlit

Streamlit Overview Actual-Prediction SHAP SHAP 2

API

FastAPI FastAPI FastAPI

Docker

Docker Run

customer-churn-project's People

Contributors

rolmez avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.