Back to all projects

Data Science · 2025

Credit Card Default Prediction

A risk-calibrated default classifier tuned to the cost asymmetry of missing a defaulter.

  • XGBoost
  • SMOTE
  • Risk Modeling
  • Finance

The modelling decision that matters

The interesting choice in this project is not the algorithm — it is the metric. Default prediction is a problem where the two kinds of error cost wildly different amounts. Flagging a customer who would have repaid costs you a little friction. Missing a customer who defaults costs you the loan.

Optimizing for accuracy on an imbalanced dataset produces a model that predicts "no default" almost always and scores well while being useless. Optimizing for F1 treats precision and recall as equally important, which they are not. This model is tuned for F2, which weights recall roughly twice as heavily as precision, matching the actual asymmetry in the cost of the two mistakes.

The final model reaches an F2 of 0.603 and identifies 84% of defaulters.

Handling class imbalance

Defaulters are a minority class, so the training set was rebalanced using SMOTE, which synthesises new minority examples by interpolating between existing ones rather than simply duplicating them — avoiding the overfitting that naive oversampling causes.

Features and threshold

Eight financial features were engineered on top of the raw fields. The decision threshold was then tuned explicitly against risk policy rather than left at the default 0.5 — a threshold is a business decision about acceptable loss, not a modelling constant.