Case study 03 — Fintech · Risk Analytics & Machine Learning
Payment Fraud Detection & Risk Analytics Dashboard
An end-to-end machine learning and analytics project that combines payment transaction risk scoring, explainable AI, SQL analytics, and an interactive dashboard.

- 0.1369
- Average Precision (PR-AUC)
- 0.7098
- ROC-AUC Score
- 68.3%
- Fraud Recall (@ 0.50)
- 100k
- Transactions Analyzed
1. Problem Statement
In high-throughput electronic payment networks (UPI, credit cards, digital wallets), fraud represents an asymmetric challenge. Less than 7% of transactions are fraudulent, meaning standard classification accuracy is misleading. Furthermore, black-box machine learning models that simply output a binary hold decision without explanation create massive friction for legitimate cardholders and compliance analysts.
2. Project Objectives
- Construct a reproducible end-to-end payment risk engineering pipeline.
- Train and benchmark classification models under severe class imbalance using PR-AUC (Average Precision) and ROC-AUC.
- Implement an explainable AI (XAI) engine delivering exact, millisecond-latency local feature attributions for any scored transaction.
- Build a transactional SQLite database in WAL mode with indexing, duplicate transaction prevention, and 17 production analytical queries.
- Deploy an interactive fintech dashboard with real-time streaming ingestion simulation.
3. Solution Architecture
The system is structured into four decoupled layers: the Data Layer (synthetic generator and live ingestion buffer), the Relational Database Layer (SQLite with B-tree indexes across customer, merchant, and timestamps), the Inference & XAI Layer (standardized pipeline with Logistic Regression and exact linear feature attribution), and the Interactive Dashboard (Streamlit fintech interface).
4. Dataset Description
The dataset contains 100,000 payment transactions modeled across 10,000 unique customer baselines:
- Customer baseline spending: Lognormally distributed (μ=3.2, σ=0.7) with customer account tenures up to 2,500 days.
- Behavioral velocity: Failed authentications in 24h, burst velocity in the last hour, and IP risk scores (0–100).
- Anomaly indicators: Spending-to-average ratio, new device indicator, international destination, and geographical displacement.
5. Machine Learning Algorithms & Benchmark
We trained and benchmarked Logistic Regression (with balanced class weighting) against a 200-tree Random Forest Classifier on a held-out test set of 20,000 transactions:
- Logistic Regression (Selected): AP (PR-AUC) = 0.1369, ROC-AUC = 0.7098, Recall = 68.26%, F1-Score = 0.2046.
- Random Forest: AP (PR-AUC) = 0.1340, ROC-AUC = 0.7325. At default 0.50 probability threshold, tree vote majorities did not cross 0.50 without recalibration, yielding 0% recall.
6. Evaluation Metrics & Diagnostic Curves


Average precision evaluates the area under the Precision–Recall curve across all operational cutoffs, proving that Logistic Regression consistently captured fraudulent patterns above random baseline.

7. Explainability Approach (XAI)
When an automated rule or model pauses a transaction, the system computes the exact additive contribution of each standardized feature: $$\text{Impact}_i = (X_i - \mu_i) \times \beta_i$$

Permutation testing revealed that ip_risk_score, is_new_device, is_international, and amount_to_customer_average_ratio are the primary global indicators driving risk assessments.
8. Three-Tier Decision Triage Framework
- Low Risk (< 30%): Auto-approved for frictionless processing.
- Medium Risk (30% – 70%): Triggers step-up 2FA/OTP verification.
- High Risk (≥ 70%): Immediate payment hold with manual analyst review.
9. Limitations & Ethical Disclosure
This project uses synthetically generated payment data influenced by statistical risk rules. Evaluation results prove the software architecture, pipeline reproducibility, and explainability workflows; they do not establish real-world fraud detection efficacy on live banking feeds.
10. Links & Verification
- Live Streamlit Dashboard: http://localhost:8501
- Source Code Repository: github.com/sabithmohamed144/payment-fraud-analytics
- Test Suite: 30 automated unit tests passing across generator, SQLite, and ML inference.