← All work
Machine Learning2025 / 12

Insurance Fraud Detection

A fraud-modeling workflow built for the metric that matters: finding suspicious claims without hiding behind overall accuracy.

scikit-learnXGBoostSHAPPython
0.86best AUC
3models compared
SHAPexplainability
Joblibdeployment artifact
01 / Context

The question
behind the work.

Fraud is an imbalanced classification problem where accuracy can look acceptable even when the model misses nearly every fraudulent claim.

My role

I built the complete modeling workflow: cleaning, preprocessing, train-test evaluation, three model families, fraud-class metrics, SHAP interpretation, saved models, and scoring scripts.

02 / Implementation

What I built.

The pipeline compares three model families, evaluates the fraud class directly, interprets drivers with SHAP, and saves reusable scoring artifacts.

  • Prepared 1,000 claims with 39 policy, claim, demographic, and vehicle features.
  • Compared logistic regression, random forest, and XGBoost under the same preprocessing and evaluation workflow.
  • Evaluated ROC-AUC, fraud precision, fraud recall, accuracy, and confusion matrices instead of relying on accuracy alone.
  • Used SHAP to expose the features driving XGBoost risk estimates and serialized models for reuse.
03 / In detail

A reusable modeling pipeline

The project starts with 1,000 insurance claims and 39 policy, claim, demographic, and vehicle features. I mapped the fraud target, split numeric and categorical inputs, applied median and most-frequent imputation, and used a scikit-learn ColumnTransformer so every model used the same preprocessing path.

Each candidate model lives inside a pipeline with its preprocessing, training, evaluation, and serialization steps. That made the comparison repeatable and left behind saved models and scoring scripts instead of a one-time notebook result.

Comparing the real tradeoff

I compared logistic regression, random forest, and XGBoost on ROC-AUC, fraud precision, fraud recall, accuracy, confusion matrices, and ROC curves. The baseline logistic model reached 0.61 AUC and detected no fraud at the default threshold.

Random Forest reached 0.86 AUC and XGBoost reached 0.83. XGBoost produced the more useful screening balance in this run, with 0.62 fraud precision, 0.51 fraud recall, and 0.81 accuracy.

Making the score inspectable

I added SHAP analysis to show how the XGBoost model was separating high- and low-risk claims. Major-damage and total-loss indicators carried strong positive influence, while policy, vehicle, and customer signals added context to the prediction.

The result is an end-to-end fraud-screening workflow that pairs model performance with feature-level explanation, reusable model artifacts, and a clear path from raw claim fields to a risk score.

04 / Engineering judgment

The decisions
that shaped it.

  1. Maintained logistic regression as an interpretable baseline before moving to nonlinear tree models.
  2. Reported fraud recall and precision alongside AUC because ranking performance alone does not define an investigation policy.
  3. Compared the model tradeoff directly: Random Forest had the strongest AUC, while XGBoost produced substantially better fraud recall.

Evaluation & results

Logistic regression reached 0.61 ROC-AUC and detected no fraud at the default threshold. Random Forest reached 0.86 AUC; XGBoost reached 0.83 AUC with 0.62 fraud precision, 0.51 fraud recall, and 0.81 accuracy.

05 / Working outputs

See it for yourself.

Select an image to view it at full size.

Next projectLung Cancer Survival