Skip to content

MuhammadBilal0111/Federated-Learning-with-Noise-and-Anonymization-for-Privacy-Preserving-User-and-Entity-Behavior

Repository files navigation

Federated Learning Simulation (sample)

This repository contains a minimal federated learning simulation using a logistic regression model.

What I added for initial testing:

  • main.py — Orchestrates a federated simulation using a SAMPLE_ROWS subset (1000 rows) of dataset/rba-dataset.csv.
  • main.py — Orchestrates a federated simulation using a SAMPLE_ROWS subset (1000 rows) of dataset/rba-dataset.csv.
  • main_fl.py — New orchestration script demonstrating Federated Learning + Differential Privacy (Gaussian noise) using the cleaned dataset dataset/rba_dataset_cleaned_100k.csv.
  • server/server.py — Simple server that aggregates client model coefficients by averaging.
  • client/client.py — Client that trains a logistic regression on its local split.
  • common/model.py — Wrapper around scikit-learn LogisticRegression to get/set weights.

Dependencies

Install dependencies into your Python environment (recommended: virtualenv):

python -m venv .venv; .\.venv\Scripts\Activate.ps1; pip install -r requirements.txt

Run the sample

The sample reads the first 1000 rows of dataset/rba-dataset.csv, splits them into 3 clients, and runs 5 federated rounds:

.\.venv\Scripts\python.exe main.py

Notes

  • If your dataset is very large, the sample uses only the first 1000 rows to avoid memory errors while developing.
  • This is a simulation (clients run locally). For a production federated system you'd implement networking, secure aggregation, and proper model serialization. Federated Learning Simulation

This repository contains a simple federated learning simulation in Python.

How it works

  • main.py splits dataset/rba-dataset.csv into N client CSVs (sampled) and runs several rounds of local training and server aggregation.
  • client/ contains the client training code.
  • server/ contains the aggregation logic.
  • common/ contains the shared model implementation.

Quick start (Windows PowerShell)

create and activate venv

python -m venv .venv; ..venv\Scripts\Activate.ps1

install deps

pip install -r requirements.txt

run

..venv\Scripts\python.exe main.py

To run the FL+DP demo (recommended after installing requirements):

pip install -r requirements.txt
.\.venv\Scripts\python.exe main_fl.py

Contributors

This project was developed collaboratively by:

Muhammad Bilal

Hashir Jamal — @hashirjamal

Muneer Hussain — @Muneer-H

Shayan Zaheer — @shayan-zaheer

About

A privacy-preserving UEBA framework using federated learning, differential privacy, and anonymization to detect intrusions collaboratively without sharing sensitive user behavior data.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors