Project Overview
Customer churn is a major challenge in the banking industry because losing existing customers directly affects revenue and long-term growth. Banks need the ability to identify customers who are likely to leave so they can implement targeted retention strategies. This project focuses on building a machine learning system that predicts whether a bank customer will churn based on demographic and financial attributes.
The project implements an end-to-end machine learning pipeline that includes data preprocessing, model training, evaluation, and deployment. Multiple machine learning models are trained and compared to identify the best performing model. The system automatically selects the best model based on performance metrics such as F1 score and accuracy.
To make the solution practical and interactive, the final model is integrated into a Streamlit dashboard where users can input customer details and instantly receive churn probability predictions. The project also follows modern MLOps practices using DVC for pipeline automation and MLflow for experiment tracking, ensuring reproducibility and scalability.
Key Features
- End-to-end customer churn prediction system
- Automated data preprocessing and feature transformation
- Multi-model training and comparison
- Automatic best model selection
- Experiment tracking using MLflow
- Reproducible ML pipeline using DVC
- Handling of class imbalance using XGBoost weighting
- Interactive Streamlit dashboard for real-time predictions
- Confusion matrix and evaluation metrics visualization
- Modular and scalable project structure
Technical Approach
The project begins with data preprocessing where irrelevant features such as customer identifiers are removed, and categorical variables like geography and gender are encoded using One-Hot Encoding. Numerical features are standardized using StandardScaler to ensure better model performance. The dataset is then split into training and testing sets using stratified sampling to maintain class distribution.
Multiple machine learning models are trained, including Logistic Regression, Random Forest, and XGBoost. These models are evaluated using performance metrics such as accuracy and F1 score, with a particular focus on F1 score due to the imbalanced nature of churn datasets. To improve minority class detection, XGBoost is configured with a dynamically calculated scale_pos_weight parameter.
The pipeline is automated using DVC, allowing reproducible training and evaluation workflows. MLflow is used to track model experiments and compare performance across different runs. The best performing model is automatically saved and deployed into a Streamlit-based user interface, enabling real-time predictions based on user input.