A graph-based deep learning system for detecting coordinated fraud rings in healthcare provider-patient networks. Uses PyTorch Geometric and Graph Attention Networks (GAT) to identify suspicious clusters that remain invisible through individual record analysis.
Traditional fraud detection methods analyze claims independently, missing coordinated fraud schemes where providers and patients collude. This system models the healthcare ecosystem as a graph and applies Graph Neural Networks to detect structural patterns indicative of fraud rings.
- Bipartite Graph Construction: Models provider-patient relationships as a heterogeneous graph with rich node and edge features
- Graph Attention Networks: Multi-head attention mechanism learns which connections are most indicative of fraud
- Community Detection: Combines GNN embeddings with Louvain community detection to identify fraud rings
- Structural Feature Engineering: Computes degree centrality, betweenness, PageRank, and clustering coefficients
- Synthetic Data Generation: Generates realistic provider-patient networks with injected fraud rings for training and evaluation
Claims Data
|
v
GraphBuilder ──> Bipartite Graph ──> Node/Edge Features
|
v
PyTorch Geometric Data
|
v
FraudGAT Model
|
┌───┴───┐
v v
Node-level Community
Fraud Scores Detection
| |
v v
Fraud Ring Rankings
gnn-fraud-rings/
├── configs/
│ └── config.yaml
├── src/
│ ├── graph_builder.py # Graph construction from claims data
│ ├── gat_model.py # GAT and GraphSAGE model definitions
│ ├── trainer.py # Training loop and fraud ring detection
│ ├── data_generator.py # Synthetic fraud graph generation
│ └── visualize.py # Network and metrics visualization
├── requirements.txt
└── README.md
pip install -r requirements.txtFor PyTorch Geometric, follow the official installation guide for your CUDA version.
from src.data_generator import SyntheticFraudGraphGenerator
from src.graph_builder import GraphBuilder
from src.gat_model import FraudGAT
from src.trainer import GNNTrainer
# Generate synthetic fraud network
generator = SyntheticFraudGraphGenerator(
num_providers=500,
num_patients=2000,
num_fraud_rings=10
)
nx_graph, labels = generator.generate()
# Build PyG data object
builder = GraphBuilder()
data = builder.from_networkx(nx_graph, labels)
# Train GAT model
model = FraudGAT(
in_channels=data.x.size(1),
hidden_channels=64,
out_channels=2,
num_layers=3,
heads=4
)
trainer = GNNTrainer(model, data)
trainer.train(epochs=200, lr=0.005)
# Detect fraud rings
rings = trainer.detect_communities(threshold=0.7)
ranked = trainer.rank_suspicious_clusters(rings)metrics = trainer.evaluate()
print(f"Precision: {metrics['precision']:.4f}")
print(f"Recall: {metrics['recall']:.4f}")
print(f"F1 Score: {metrics['f1']:.4f}")
print(f"AUC-ROC: {metrics['auc_roc']:.4f}")from src.visualize import plot_graph_with_communities, plot_fraud_scores
plot_graph_with_communities(nx_graph, rings, save_path="fraud_rings.png")
plot_fraud_scores(trainer.get_fraud_scores(), save_path="fraud_heatmap.png")The primary model uses multi-head graph attention with skip connections:
- Input: Node feature vectors (provider/patient attributes + structural features)
- Hidden Layers: Configurable GAT layers with multi-head attention
- Output: Per-node fraud probability scores
An alternative GraphSAGE-based model is provided for comparison, using neighborhood sampling for inductive learning.
- Graph Construction: Build provider-patient bipartite graph from claims data
- Feature Engineering: Compute node features (specialty, volume, demographics) and structural features (centrality, PageRank)
- GNN Training: Train GAT model on labeled fraud/non-fraud nodes
- Score Prediction: Generate per-node fraud probability scores
- Community Detection: Apply Louvain algorithm on GNN-learned embeddings
- Ring Ranking: Score communities by aggregate fraud probability and structural anomaly metrics
See configs/config.yaml for all configurable parameters including model architecture, training hyperparameters, and graph generation settings.
MIT License