Flight JB 201
Payments fraud detection
Leakage-safe fraud model reaching 0.59 PR-AUC on 590K transactions at a 3.5% fraud rate, with a cost-based threshold and 50 tests.

Stack
In numbers
- PR-AUC on the test set
- 0.59
- transactions
- 590K
- fraud rate
- 3.5%
- tests
- 50
Case study
Problem
At a 3.5% fraud rate, accuracy misleads: a model that never flags fraud is still right 96.5% of the time.
What I did
- Split the data chronologically, with leakage controls, so the model is only ever tested on later transactions.
- Measured with PR-AUC instead of accuracy, and tuned LightGBM with Optuna.
- Explained the model's decisions with SHAP.
- Chose the decision threshold by cost.
- Served the model with FastAPI in Docker, covered by 50 tests.
Result
A test PR-AUC of 0.59 on 590,540 transactions from the IEEE-CIS Fraud Detection dataset. The same model scored every bag in the security check on this site, in advance.
Screenshots
Validation PR-AUC by model, from the tuned LightGBM down to the baselines. Validation cost by decision threshold; the chosen threshold sits at the lowest cost. PR-AUC and fraud rate over time, across the training, validation and test periods. Mean SHAP values for the strongest features.