System Architecture
Emulator
Generates Tx
Async Task
→
FastAPI Backend
ML Engine
DB Handling
WebSocket Mgr
↔
SQLite DB
Persistence
Frontend Dashboard
Jinja2 + Tailwind + Chart.js
Real-time WebSockets
Data Flow
- Emulator creates a transaction (Normal or Anomaly).
- ML Engine predicts score and class using the active model (Isolation Forest, LOF, SVM, Robust Covariance, or Neural Network).
- Result is saved to SQLite Database.
- WebSocket Manager broadcasts the new data point.
- Frontend receives JSON and updates charts/stats instantly.
Tech Stack
- Language: Python 3.10
- Framework: FastAPI (High performance async)
- ML Libraries: Scikit-Learn (Isolation Forest, MLP, etc.), NumPy
- Database: SQLAlchemy ORM + SQLite
- Frontend: TailwindCSS, Chart.js
- Deployment: Docker & Docker Compose
Neural Network Architecture (MLP)
Input (4)
Amount, Diff, Hour, Foreign
→
Dense (64)
ReLU Activation
→
Dense (32)
ReLU Activation
→
Output (1)
Sigmoid (Prob)