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

  1. Emulator creates a transaction (Normal or Anomaly).
  2. ML Engine predicts score and class using the active model (Isolation Forest, LOF, SVM, Robust Covariance, or Neural Network).
  3. Result is saved to SQLite Database.
  4. WebSocket Manager broadcasts the new data point.
  5. 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)