Instructions to use Omarsy2/Bank-Retention-Recommendation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use Omarsy2/Bank-Retention-Recommendation with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("Omarsy2/Bank-Retention-Recommendation", "sklearn_model.joblib") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
Bank Retention & Product Recommendation
An AI-powered banking machine learning system that combines customer churn prediction with personalized financial product recommendation.
The system consists of two trained machine learning pipelines designed to support proactive customer retention and personalized banking services.
Models
1. Customer Churn Prediction
Pipeline: churn_bank_pipeline.pkl
A LightGBM-based classification pipeline designed to predict whether a banking customer is likely to churn.
The pipeline includes the required preprocessing steps, SMOTE-based class balancing, and the final LightGBM classifier.
Model: LightGBM Task: Binary Classification Dataset: Bank Customer Churn Modelling Dataset Records: 10,000
Performance
| Metric | Score |
|---|---|
| Accuracy | 0.89 |
| Precision | 0.92 |
| Recall | 0.86 |
| F1-Score | 0.89 |
The model was selected after comparing multiple machine learning algorithms, including Logistic Regression, KNN, Decision Tree, Random Forest, AdaBoost, and XGBoost.
2. Banking Product Recommendation
Pipeline: recommendations_bank_pipeline.pkl
A unified multi-class XGBoost recommendation pipeline designed to predict the most relevant financial product based on customer behavioral and temporal features.
The system was developed using the Santander Product Recommendation dataset and leverages historical customer behavior and temporal features to identify potential future product acquisitions.
Model: XGBoost Task: Multi-Class Classification Dataset: Santander Product Recommendation Dataset Training Data: Approximately 8 million records
Validation Performance
The unified XGBoost model achieved strong performance across the retained product categories, with F1-Scores ranging from 0.73 to 0.97.
Selected results include:
| Product | Precision | Recall | F1-Score |
|---|---|---|---|
| Current Account | 0.99 | 0.95 | 0.97 |
| Direct Debit | 0.94 | 0.96 | 0.95 |
| e-Account | 0.94 | 0.94 | 0.94 |
| Payroll | 0.91 | 0.94 | 0.92 |
| Credit Cards | 0.92 | 0.89 | 0.91 |
| Taxes | 0.85 | 0.96 | 0.90 |
| Particular Plus | 0.89 | 0.90 | 0.90 |
| Long-term Deposits | 0.85 | 0.92 | 0.89 |
System Architecture
The overall system follows a two-stage approach:
Customer Data
│
â–¼
Customer Churn Prediction
│
│ High Churn Risk
â–¼
Banking Product Recommendation
│
â–¼
Personalized Financial Product
Customers identified as being at higher risk of churn can be passed to the recommendation stage, where the system predicts a relevant financial product based on their historical and behavioral patterns.
Model Files
| File | Description |
|---|---|
churn_bank_pipeline.pkl |
LightGBM pipeline for customer churn prediction |
recommendations_bank_pipeline.pkl |
Unified multi-class XGBoost pipeline for banking product recommendation |
Usage
The pipelines can be loaded using joblib:
import joblib
# Load the churn prediction pipeline
churn_model = joblib.load("churn_bank_pipeline.pkl")
# Load the product recommendation pipeline
recommendation_model = joblib.load(
"recommendations_bank_pipeline.pkl"
)
Predictions can then be generated using the input features expected by each pipeline:
churn_prediction = churn_model.predict(X)
recommendation_prediction = recommendation_model.predict(X)
For probability-based predictions:
churn_probability = churn_model.predict_proba(X)
recommendation_probabilities = recommendation_model.predict_proba(X)
Key Features
- Customer churn prediction
- Proactive customer retention
- Personalized banking product recommendation
- Machine learning-based customer segmentation
- Temporal behavioral feature engineering
- SMOTE-based class balancing for churn prediction
- Multi-class product recommendation
- Scalable machine learning pipelines
Technologies
- Python
- Scikit-learn
- LightGBM
- XGBoost
- Pandas
- NumPy
- SMOTE
- Joblib
Project Context
This project was developed as part of an AI-powered banking ecosystem, aiming to combine predictive analytics and personalized recommendations to improve customer retention and enhance the banking experience.
The trained models can be integrated into production applications through an API-based deployment architecture.
Limitations
- The models were trained and evaluated on historical datasets and may not generalize directly to real-world banking environments.
- The product recommendation model is based on historical customer behavior and may be affected by changes in customer preferences or financial product offerings.
- The datasets used for training are public datasets and do not represent real confidential banking customer data.
License
MIT License
- Downloads last month
- -