ZO
ZohaibHassan16/FraudGuard
A real-time fraud detection pipeline using an Autoencoder to monitor and flag anomalies in streaming financial transaction data.
Real-Time Fraud Detection (Autoencoder)
This project uses an Autoencoder neural network to detect fraudulent mobile money transactions in real-time. It includes a web-based dashboard that simulates a live security monitor.
Demo
The dashboard visualizes the reconstruction error (MSE). Normal transactions (blue) have low error, while fraud (red spikes) exceeds the threshold.

Concept
The model is an anomaly detector trained only on normal transactions.
- Normal Input: The model reconstructs it well (Low MSE).
- Fraud Input: The model cannot reconstruct it (High MSE).
- Threshold: If MSE > 95th percentile of normal data, the transaction is flagged.
Dataset
- Source: PaySim (Mobile Money Simulation) on Kaggle.
- Filtering: Used only
TRANSFERandCASHOUTtypes. - Preprocessing: Log transformation and Standard Scaling applied to amounts and balances.
Tech Stack
- ML: TensorFlow/Keras, Scikit-learn
- Backend: FastAPI, Uvicorn
- Visualization: Chart.js (Frontend), Matplotlib
- Tunneling: Pyngrok (to expose the local server)
How to Run
- Open
RT_FraudDetection.ipynbin Google Colab or Jupyter. - Upload the CSV you downloaded from Kaggle.
- Run the cells to train the Autoencoder.
- The final cell launches the server and generates a public URL (e.g.,
ngrok-free.dev). - Click the link to view the live simulation.