Logo Lanfrica

myraissa/tunisian-ecommerce-churn

Record type:

project
Creator:
myr
Host:
# Tunisian E-Commerce Churn Prediction ## Project Overview This project implements a complete MLOps pipeline for customer churn prediction, including: - Data preprocessing and feature engineering - Multiple ML model training and evaluation - REST API deployment with FastAPI - Interactive Streamlit dashboard - Comprehensive model analytics ### Key Features - **High Accuracy Models**: Achieved 97.7% accuracy with XGBoost - **Real-time Predictions**: FastAPI-based REST API for instant predictions - **Interactive Dashboard**: Streamlit interface for business users - **Batch Processing**: Support for bulk customer predictions - **Actionable Insights**: Automated recommendations based on churn risk ## Model Performance | Model | Accuracy | F1-Score | ROC-AUC | |-------|----------|----------|---------| | Logistic Regression | 92.3% | 91.8% | 0.9654 | | Random Forest | 97.3% | 97.1% | 0.9956 | | Gradient Boosting | 96.7% | 96.5% | 0.9942 | | **XGBoost** | **97.7%** | **97.5%** | **0.9968** | | LightGBM | 97.4% | 97.3% | 0.9962 | ## Results (overview) The confusion matrices show good performance, especially with XGBoost and LightGBM. - XGBoost: TN=932, FP=4, FN=10, TP=180 (excellent compromis) Image - LightGBM: TN=931, FP=5, FN=12, TP=178 Image - Random Forest: TN=933, FP=3, FN=27, TP=163 Image Feature importance (XGBoost): DaysPerOrder, Complain, OrderCount are among the most influential Image ## Getting Started ### Prerequisites - Python 3.8 or higher - pip package manager - Virtual environment (recommended) ### Installation 1. **Clone the repository** ```bash git clone github.com cd tunisian-ecommerce-churn ``` 2. **Create virtual environment** ```bash python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate ``` 3. **Install dependencies** ```bash pip install -r requirements.txt ``` ### Quick Start #### 1. Run the API ```bash cd api uvicorn api:app --reload ``` Access the API docu …