Skip to content
aggarmokshPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

FDRPay: Federated Learning for Credit Card Fraud Detection

Overview

FDRPay is a full-stack federated learning platform for privacy-preserving credit card fraud detection. It leverages Flower, PyTorch, and modern web technologies to enable distributed, secure, and explainable AI on sensitive financial data.


Features

  • Federated Learning: Train models across multiple clients without sharing raw data
  • Advanced Metrics: Real-time dashboard for AUC, F1, Precision, Recall, Loss, Fraud Rate, and Risk Score Distribution
  • Hyperparameter Optimization: Automated tuning with Optuna
  • Differential Privacy: Configurable noise addition for privacy
  • Modern Frontend: Interactive dashboard and reporting (React, Material-UI, Recharts)
  • API Backend: FastAPI server for analytics and dashboard data
  • PDF/Excel Reporting: Generate stakeholder-ready analytics reports
  • Scalable & Modular: Easily extendable for new features and datasets

Architecture

+-------------------+      +-------------------+      +-------------------+
|   FL Clients      | <--> |   FL Server       | <--> |   Metrics/Models  |
| (PyTorch, Flower) |      | (Flower, PyTorch) |      |   (Disk)         |
+-------------------+      +-------------------+      +-------------------+
         |                          |
         v                          v
+-----------------------------------------------------+
|                FastAPI Analytics API                |
+-----------------------------------------------------+
         |
         v
+-----------------------------------------------------+
|                React Frontend Dashboard             |
+-----------------------------------------------------+

Getting Started

1. Clone the Repository

git clone <your-repo-url>
cd FDRPay

2. Python Environment & Backend Setup

python -m venv .venv
# Activate the environment
# On Windows:
.venv\Scripts\activate
# On Unix/Mac:
source .venv/bin/activate

pip install -r requirements.txt

3. Start the Federated Server

python fl_server.py

4. Start Federated Clients (in 5 terminals)

set CLIENT_ID=0
python fl_client.py
# Repeat for CLIENT_ID=1,2,3,4 in separate terminals

5. Start the FastAPI Analytics Backend

pip install fastapi uvicorn
uvicorn backend.api:app --reload

6. Frontend Setup

cd frontend
npm install --legacy-peer-deps
npm run dev

Visit http://localhost:3000 in your browser.


Usage

  • Dashboard: Real-time analytics, model metrics, fraud rate, risk score distribution
  • Reports: Generate PDF/Excel reports for any date range
  • Live Training: Watch metrics update as federated rounds progress

Project Structure

FDRPay/
├── backend/           # FastAPI analytics API
├── data/              # Data files (e.g., creditcard.csv)
├── frontend/          # React dashboard app
├── metrics/           # Metrics JSON files (auto-generated)
├── models/            # Saved PyTorch models
├── fl_client.py       # Federated client code
├── fl_server.py       # Federated server code
├── requirements.txt   # Python dependencies
└── README.md          # This file

Customization & Extensions

  • Add new metrics: Update fl_client.py and backend/api.py
  • Add new visualizations: Edit frontend/src/components/Dashboard/Dashboard.jsx
  • Change model architecture: Edit the Net class in fl_client.py and fl_server.py
  • Integrate new datasets: Place CSVs in data/ and update data loading logic

Security & Privacy

  • Differential privacy (configurable)
  • No raw data leaves client machines
  • Ready for SSL/TLS and authentication extensions

License

MIT License


Acknowledgements


Contact

For questions or contributions, open an issue or pull request on GitHub.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages