Back to Projects
Marketing Analytics / ML

Decision Tree & SHAP: Bank Marketing Prediction

A tree-based model comparison and SHAP interpretability study on the UCI Bank Marketing dataset, identifying which factors genuinely drive term-deposit subscription success under substantial class imbalance, and turning that into an actionable campaign strategy.

Type
Classification
Domain
Marketing / Banking
Methods
Gradient Boosting, XGBoost, SHAP
Status
Completed
MODEL COMPARISON
ROC-AUC 0.9485
BASELINE DT • 0.738
TUNED DT • 0.921
XGBOOST • 0.920
GRADIENT BOOSTING • 0.9485

The Challenge

Gradient Boosting reached 0.9485 ROC-AUC predicting term-deposit subscriptions, with SHAP analysis revealing call duration, not customer demographics, as the dominant driver of conversion.

A marketing team running these campaigns needed to know which contacts were worth calling, and why some conversations converted while most didn't. The dataset was heavily imbalanced (88.6% no-subscription vs 11.4% subscription), which makes naive accuracy misleading and model interpretability essential for turning predictions into an actual campaign strategy.

Approach

01
Exploration & Encoding
Loaded the UCI Bank Marketing dataset, examined target distribution and class imbalance, and label-encoded categorical variables. No feature standardisation was applied, correctly, since tree-based models don't require it.
02
Model Comparison
Trained and evaluated five tree-based approaches side by side: Decision Tree, Random Forest, AdaBoost, Gradient Boosting, and XGBoost, using ROC-AUC as the primary metric given the class imbalance.
03
Hyperparameter Tuning
Optimised the Decision Tree specifically using grid search with both pre-pruning and post-pruning techniques, to isolate how much of its underperformance was fixable through tuning alone.
04
SHAP Interpretation
Applied SHAP values to the best-performing model to understand which features actually drove subscription predictions, and in which direction, rather than treating the model as a black box.

Results

0.9485
ROC-AUC, Gradient Boosting — best of five models compared
+24.8%
ROC-AUC improvement from hyperparameter tuning the baseline Decision Tree (0.738 → 0.921)
88.6% / 11.4%
Class imbalance in the raw dataset, handled explicitly rather than ignored

Gradient Boosting was the clear winner at 0.9485 ROC-AUC, narrowly ahead of a tuned Decision Tree (0.921) and XGBoost (0.920), with the untuned baseline Decision Tree trailing well behind at 0.738, a result that shows how much of tree-based model performance comes down to tuning discipline rather than algorithm choice alone.

SHAP analysis identified call duration as by far the strongest predictor of a successful subscription, with a clear positive relationship: longer, more substantive conversations converted more often. Macroeconomic indicators (employment variation rate, number employed) were the next most influential signals, both negatively correlated with subscription, ahead of campaign contact frequency and customer age.

Business Impact

The SHAP findings translate directly into a call-quality-over-quantity strategy: training agents toward longer, higher-value conversations rather than maximising call volume, timing campaign intensity around favourable macroeconomic conditions, and capping contact frequency to avoid the fatigue effect the model surfaced. Deployed for real-time lead scoring, the Gradient Boosting model gives the marketing team a way to prioritise high-potential contacts before they pick up the phone, rather than after.

Technology Stack

Python Scikit-learn XGBoost SHAP GridSearchCV Pandas
Interested in this work or something similar?