M-Pesa mobile money fraud detection using XGBoost and SMOTE — ROC-AUC 0.9990
---
title: M-Pesa Fraud Detection
emoji: 🔍
colorFrom: teal
colorTo: green
sdk: gradio
sdk_version: 4.0.0
app_file: app.py
pinned: true
---
## M-Pesa Fraud Detection
Mobile money fraud is a real problem in Kenya. I built this to show how machine learning can catch it.
Trained on 6.3 million transactions from the PaySim dataset. The model looks at things like whether a sender's account was completely drained, whether the recipient's balance didn't change after receiving money, and what fraction of the sender's balance was transferred — patterns that show up consistently in fraudulent transactions.
## How it works
Enter the transaction details and click Check Transaction. It tells you instantly whether the transaction looks suspicious and why.
## Results
| Model | ROC-AUC | Fraud Precision | Fraud Recall |
|---|---|---|---|
| Logistic Regression | 0.9951 | 13% | 95% |
| Random Forest | 0.9990 | 97% | 100% |
| XGBoost | 0.9987 | 96% | 100% |
Random Forest came out on top — it caught every single fraud case with 97% precision.
## Tools used
Python, Pandas, Scikit-learn, XGBoost, SMOTE, Gradio
## About
Built by Jemimah Mugure Kaberia
BSc Data Science, Co-operative University of Kenya
github.com