- Overview
- Project Highlights
- Data Analysis and Insights
- Features
- Project Structure
- Getting Started
- Usage
- Technical Components
- Model Performance
- Example Scenario
- Contributing
- License
The Bank Customer Churn Prediction App is a comprehensive data science project designed to predict customer account closures (churn) using advanced machine learning techniques. This end-to-end solution transforms raw customer data into actionable insights, helping financial institutions proactively manage customer retention.
- 🤖 Advanced ML Ensemble: XGBoost, LightGBM, and CatBoost
- 📊 High Prediction Accuracy: AUC Score of 0.891
- 🌐 Web Interface: Flask-based predictive application
- 🐳 Containerized Deployment: Docker support
- 📈 Comprehensive Data Analysis: In-depth exploratory analysis
- Language: Python 3.11.5
- Core Libraries:
- Pandas, NumPy
- Scikit-learn
- Matplotlib, Seaborn
- Framework: Flask
- Containerization: Docker
- Churn Rate: 21% of customers in the dataset
- Geographic Trends:
- Highest churn rate in Germany
- Demographic Observations:
- Females showed higher churn propensity
- Customer Activity:
- Non-active members more likely to churn
- Created
Age-Tenure Ratio
- Developed
Active Credit Card Status
- Implemented targeted encoding strategies
- Zero-balance accounts have higher churn probability
- Credit card ownership minimally impacts churn
- Customers with 3-4 products exhibit increased churn risk
- Ensemble Classifiers:
- XGBoost
- LightGBM
- CatBoost
- Advanced preprocessing techniques
- Hyperparameter optimization
- Intuitive user interface
- Real-time churn prediction
- Sample data auto-fill functionality
- Docker containerization
- Easy-to-use deployment
.
├── README.md # Project documentation
├── app/ # Flask application
│ ├── app.py # Main application entry point
│ ├── static/ # Static web resources
│ │ └── styles.css # Application styling
│ ├── templates/ # HTML templates
│ │ ├── base.html
│ │ ├── form.html
│ │ └── result.html
│ └── utils.py # Utility functions
├── models/ # Machine learning models
│ ├── train.py # Model training script
│ ├── test.py # Model testing script
│ └── model.joblib # Trained model
├── requirements.txt # Python dependencies
└── dockerfile # Docker configuration
- Python 3.10+
- Docker (optional)
- pip package manager
-
Clone the repository:
git clone https://github.com/your-username/bank-churn-prediction.git cd bank-churn-prediction
-
Create virtual environment:
python -m venv .venv source .venv/bin/activate # Unix/macOS # or .venv\Scripts\activate # Windows
-
Install dependencies:
pip install -r requirements.txt
# Build Docker image
docker build -t churn-prediction-app .
# Run container
docker run -p 5000:5000 churn-prediction-app
# OR pull pre-built image
docker pull sayedgamal/churn-prediction-app:latest
docker run -p 5000:5000 sayedgamal/churn-prediction-app:latest
- Navigate to
http://localhost:5000
- Input customer details
- Click "Predict" for churn probability
Explore detailed analysis in bank-customer-churn-prediction-0-891-auc-score.ipynb
- Preprocessing:
- Target encoding
- Feature scaling
- Custom engineering pipelines
- Model Training:
- Ensemble voting mechanism
- Cross-validation
- Deployment:
- Flask web framework
- Docker containerization
- AUC Score: 0.891
- Algorithms: XGBoost, LightGBM, CatBoost
Feature | Value |
---|---|
Age | 45 |
Credit Score | 750 |
Geography | Germany |
Gender | Female |
Active Member | Yes |
etc..
Predicted Churn Probability: 76%
Contributions are welcome!
Steps to contribute:
- Fork the repository
- Create your feature branch
- Commit changes
- Push to the branch
- Create a pull request
Developed with ❤️ by Sayed Gamal