Skip to content
Ho Dinh Tri
Work

Applied AI

Insurance Fraud Detection: A Leakage-Safe ML Pipeline

145 behavioural features and a leakage-safe SMOTE + XGBoost pipeline that raised fraud recall from 18.4% to 65.0% at 0.840 ROC-AUC.

Screenshot of Insurance Fraud Detection: A Leakage-Safe ML Pipeline

At a glance

fraud recall
18.4% → 65.0%
held-out data, before vs after the leakage-safe resampling pipeline
ROC-AUC
0.840
held-out data
F1 (fraud class)
0.63
at the chosen decision threshold
engineered features
145
behavioural and claim-level

Problem#

Fraudulent claims are a small minority. A model can be very “accurate” by predicting “not fraud” every time, and catch almost nothing.

A decision I made#

Prioritise recall. In fraud, being right 99 times and missing once can still cost a lot, so I’d rather flag too many claims than miss real ones. But if everything gets flagged, investigators drown in reviews. So the decision threshold has to balance the two, and I exposed it so it can be tuned against review costs.

How I kept the evaluation honest#

  • Split the data by time, so the test set holds later claims than the training set.
  • Applied SMOTE and scaling only inside the training folds of stratified K-fold, so nothing from validation data leaks into training.
  • Kept everything in one scikit-learn pipeline, so training and serving apply identical transformations.

What I built#

  • 145 behavioural features and an XGBoost classifier, with SHAP explanations for individual predictions.
  • Served through FastAPI and a Streamlit dashboard with Docker Compose, covered by automated tests and schema contracts.

Results#

Recall on the fraud class rose from 18.4% to 65.0% at 0.840 ROC-AUC, with an F1 of 0.63.

Limitations: what this does not prove#

  • 65% recall still means roughly one in three fraud cases is missed.
  • The model was trained and tested on a public dataset, not an insurer’s production data.
  • The best threshold depends on cost assumptions that would need to come from the business.
All work