Skip to content

About

Insurance-claims fraud detection with a stacked XGBoost, LightGBM and CatBoost ensemble and SHAP explanations.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Insurance Claims Fraud Detection

Gradient-boosted ensemble system for identifying fraudulent insurance claims. Combines XGBoost, LightGBM, and CatBoost in a stacking architecture over engineered provider, claim, temporal, and network features.

Uses a generated synthetic claims dataset for demonstration; no real claims data is included.

Overview

Insurance fraud represents billions in annual losses across the industry. This system applies modern gradient boosting methods with extensive feature engineering to flag suspicious claims for investigation. The ensemble approach balances sensitivity (catching fraud) against specificity (avoiding false positives that waste investigator time).

Key capabilities:

  • Engineered features spanning provider behavior, claim characteristics, temporal patterns, and network relationships
  • Stacking ensemble with XGBoost, LightGBM, and CatBoost as base learners and logistic regression as the meta-learner
  • Automated hyperparameter optimization via Optuna with cross-validated average precision as the objective
  • Interpretable predictions through SHAP values and feature importance analysis
  • Class imbalance handling using SMOTE, ADASYN, and model-native class weighting

Architecture

Raw Claims Data
      |
      v
Data Preprocessing
(imputation, encoding, balancing)
      |
      v
Feature Engineering
 |          |            |           |
 v          v            v           v
Provider  Claim      Temporal    Network
Features  Features   Features    Features
      \      |          |       /
       v     v          v      v
      Combined Feature Matrix
      |          |          |
      v          v          v
  XGBoost   LightGBM   CatBoost
      \         |         /
       v        v        v
     Stacking Meta-Learner
            |
            v
     Fraud Probability

Installation

git clone https://github.com/ln-bodicherla/fraud-detection-ensemble.git
cd fraud-detection-ensemble

python -m venv venv
source venv/bin/activate

pip install -r requirements.txt

Quick Start

Generate synthetic data and train

from src.data_preprocessing import DataPreprocessor
from src.feature_engineering import FeatureEngineer
from src.model_training import FraudDetectionModel
from src.evaluation import ModelEvaluator

# Generate synthetic demo data
preprocessor = DataPreprocessor()
df = preprocessor.generate_synthetic_data(n_samples=50000, fraud_rate=0.05)

# Preprocess
df = preprocessor.handle_missing_values(df)
df = preprocessor.encode_categoricals(df)
X_train, X_test, y_train, y_test = preprocessor.create_train_test_split(df)

# Engineer features
engineer = FeatureEngineer()
X_train = engineer.build_feature_matrix(X_train)
X_test = engineer.build_feature_matrix(X_test)

# Train ensemble
model = FraudDetectionModel()
model.train_stacking_ensemble(X_train, y_train)

# Evaluate
evaluator = ModelEvaluator(model, X_test, y_test)
evaluator.generate_evaluation_report("reports/")

Make predictions on new data

python src/predict.py --input data/new_claims.csv --output predictions.csv

Feature Groups

Provider Features

  • Average claim amount per provider
  • Claim frequency (daily, weekly, monthly)
  • Specialty deviation score
  • Patient volume relative to peers
  • Out-of-network billing ratio

Claim Features

  • Diagnosis-procedure mismatch score
  • Claim amount z-score
  • Service duration anomaly flag
  • Number of procedures per claim
  • Unusual billing code combinations

Temporal Features

  • Rolling window claim counts (7d, 30d, 90d)
  • Time between consecutive claims
  • Weekend and holiday submission flags
  • Claim velocity acceleration

Network Features

  • Provider-patient pair frequency
  • Referral chain depth
  • Shared patient count between providers
  • Geographic outlier score

Model Performance

No benchmark results are published in this repository. ModelEvaluator.generate_evaluation_report("reports/") (see Quick Start) computes AUC-ROC, AUC-PR, precision, recall, F1, a confusion matrix and a threshold analysis on the held-out split and writes them, with ROC/PR plots, to reports/. Because the data is synthetic, these numbers only show that the pipeline runs end to end; they say nothing about performance on real claims.

Configuration

Model hyperparameters and training settings are defined in configs/model_config.yaml. Optuna can be used to automatically optimize these parameters.

Project Structure

fraud-detection-ensemble/
├── configs/
│   └── model_config.yaml
├── notebooks/
│   └── exploration.py
├── src/
│   ├── data_preprocessing.py
│   ├── evaluation.py
│   ├── feature_engineering.py
│   ├── model_training.py
│   └── predict.py
├── requirements.txt
└── README.md

License

MIT License

About

Insurance-claims fraud detection with a stacked XGBoost, LightGBM and CatBoost ensemble and SHAP explanations.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages