ML · Imbalanced Classification
Credit Card Fraud Detection
A fraud-detection pipeline on a 284k-transaction dataset with a 0.17 per cent fraud rate, comparing three models with SMOTE and precision-recall evaluation.
The challenge.
The dataset has 284,807 transactions and a 0.17 per cent fraud rate. A naive model scores 99.8 per cent accuracy by predicting that nothing is ever fraud, so accuracy is a trap and the whole problem lives in how you handle the imbalance.
The approach.
SMOTE oversampling on the training split, a comparison of XGBoost, Random Forest and Logistic Regression, and evaluation using classification reports, confusion matrices, ROC curves and precision-recall curves.
Engineering decisions.
-
SMOTE applied to the training split after a stratified train/test split.
-
Three models compared head to head: XGBoost, Random Forest and Logistic Regression.
-
Classification reports, confusion matrices, ROC and precision-recall curves for evaluation on imbalanced data.
-
Reproducible Python training and evaluation scripts.
The outcome.
Reproducible model comparison using precision, recall, F1 and ROC-AUC, with Python training and evaluation scripts available on GitHub. The hosted demo is currently offline.