Back to Projects
Classification / Banking

Bank Customer Churn Classification

Decision tree and random forest models predicting which retail bank customers will leave, with the trade-off between catching churners and false alarms made explicit.

Type
Classification
Domain
Retail Banking
Methods
Decision Tree, Random Forest
Origin
Cambridge DS Career Accelerator coursework

The Challenge

A random forest classified bank customers' churn with 86.1% accuracy, while a balanced decision tree caught more churners (recall 0.70) at the cost of more false alarms.

Losing a retail banking customer costs far more than retaining one, but retention offers are expensive to send to everyone. The task was to predict churn from customer attributes and understand the trade-off between catching churners and wasting offers.

Approach

01
Data
5,034 customers, 10 features, 20.8% churn rate.
02
Decision trees
Gini and entropy criteria, depth and leaf-size tuning, and class weighting to give the minority churn class more influence.
03
Random forest
Ensemble of trees compared against the best single tree on accuracy, precision, recall and F1.

Results

86.1%
Random forest accuracy
0.61
Random forest F1 for churners (precision 0.74, recall 0.52)
0.70
Recall of the balanced decision tree (depth 8), F1 0.59

The random forest was more accurate, but missed about half of the churners. The class-weighted tree caught about 70% of them with lower precision, which may suit a cheap retention action better. The right choice depends on the relative cost of a missed churner and an unnecessary offer.

Limitations: hyperparameters were chosen on the test set, and ROC AUC was computed from hard predictions rather than probabilities, which understates it. A clean re-run would tune on a validation split.

How it was tested

TEST REPORTTEST REPORTBANK CHURNBANK CHURN
Checked
  • Random forest compared with the best single tree on accuracy, precision, recall and F1 for churners.
  • Class weighting tested to give the minority churn class more influence.
Found
  • The random forest was more accurate but missed about half of the churners (recall 0.52).
Limits
  • Hyperparameters were chosen on the test set; a clean re-run would tune on a validation split.
  • ROC AUC was computed from hard predictions rather than probabilities, which understates it.

Technology Stack

Python scikit-learn pandas NumPy Matplotlib
Interested in this work or something similar?