Real-time fraud detection for European cardholders
An end-to-end fraud-detection system that scores card transactions for fraud risk in real time — integrating machine learning, cloud deployment and a live web interface for analysts.
The problem
Financial fraud is a persistent, high-cost problem in banking, and fraud signals are rare and highly imbalanced. The challenge was to score transactions for fraud instantly while keeping the system explainable and usable by non-technical analysts.
Approach
I built a Random Forest model with SMOTE to handle the extreme class imbalance typical of fraud data, then wrapped it in an interface that returns an instant fraud probability for each transaction and tracks history for analysis.
- Random Forest classifier with SMOTE balancing
- Instant fraud-probability scoring per transaction
- Transaction history tracking with CSV export
Architecture
A FastAPI service exposes the model, while a Streamlit application provides the analyst-facing interface. The design separates the scoring API from the UI so each can scale and evolve independently.
- FastAPI scoring service
- Streamlit analyst interface
- CSV export for downstream analysis
Deployment
The API was deployed serverless on AWS Lambda and on Render, with the Streamlit interface served from an AWS EC2 instance behind Nginx — demonstrating a full cloud path from model to usable product.
- FastAPI on AWS Lambda + Render
- Streamlit UI on AWS EC2 behind Nginx
Business value
The system shows how machine learning, MLOps and cloud deployment combine into a scalable, efficient fraud-screening tool — giving analysts instant, exportable risk signals rather than a static model.
Lessons learned
For rare-event problems like fraud, the modelling choice is inseparable from how you handle imbalance.
A thin, well-separated UI over a scoring API makes ML genuinely usable by business teams.
Deploying across Lambda, EC2 and Render proved the pipeline is portable across cloud targets.