This repository contains the complete source code for the paper "Robust Federated Learning for Detecting False Data Injection Attacks in Advanced Metering Infrastructure under Non-IID Data." The framework couples a lightweight two-branch GRU local detector with a server-side robust aggregation pipeline (per-client EMA smoothing, client-level trimmed filtering, and deviation-aware cosine weighting) to detect false data injection attacks (FDIA) in advanced metering infrastructure under non-IID household data and malicious-client poisoning. Contents: Data preparation: preprocess.py, ami_utils.py, select_households.py, partition_clients.py (ACORN-based non-IID partitioning), windowing.py, temporal_split.py (chronological train/validation/test split with embargo). Attack synthesis: synthesize_fdia.py (scaling, step, and gradual FDIA patterns under a 3-sigma stealth cap); poisoning.py (label flipping, Gaussian noise, parameter scaling, sign flipping, model replacement, min-max/min-sum, and intermittent poisoning). Model and federation: model_gru.py (two-branch GRU detector), fl_client.py and fl_server.py (robust aggregation), aggregators_baselines.py (FedAvg, Krum/Multi-Krum, coordinate-wise median, trimmed-mean, Bulyan, geometric-median/RFA, SCAFFOLD, FLTrust, Cos-Ref, FedCAP, SmartFL), metrics.py. Experiment drivers (one per table/figure): run_main.py, run_poisoning.py, run_ablation.py, run_beta_sweep.py, run_noniid_sweep.py, run_cross_dataset.py, run_scale_efficiency.py, orchestrated by experiment_runner.py. requirements.txt lists all dependencies; random seeds 2026–2030 reproduce the reported runs. Data availability: this deposit contains code only. The Low Carbon London and GoiEner smart-meter datasets are publicly available from their original providers; access instructions are given in the paper's Data Availability Statement.
This repository contains the complete source code for the paper "Robust Federated Learning for Detecting False Data Injection Attacks in Advanced Metering Infrastructure under Non-IID Data." The framework couples a lightweight two-branch GRU local detector with a server-side robust aggregation pipeline (per-client EMA smoothing, client-level trimmed filtering, and deviation-aware cosine weighting) to detect false data injection attacks (FDIA) in advanced metering infrastructure under non-IID household data and malicious-client poisoning. Contents: Data preparation: preprocess.py, ami_utils.py, select_households.py, partition_clients.py (ACORN-based non-IID partitioning), windowing.py, temporal_split.py (chronological train/validation/test split with embargo). Attack synthesis: synthesize_fdia.py (scaling, step, and gradual FDIA patterns under a 3-sigma stealth cap); poisoning.py (label flipping, Gaussian noise, parameter scaling, sign flipping, model replacement, min-max/min-sum, and intermittent poisoning). Model and federation: model_gru.py (two-branch GRU detector), fl_client.py and fl_server.py (robust aggregation), aggregators_baselines.py (FedAvg, Krum/Multi-Krum, coordinate-wise median, trimmed-mean, Bulyan, geometric-median/RFA, SCAFFOLD, FLTrust, Cos-Ref, FedCAP, SmartFL), metrics.py. Experiment drivers (one per table/figure): run_main.py, run_poisoning.py, run_ablation.py, run_beta_sweep.py, run_noniid_sweep.py, run_cross_dataset.py, run_scale_efficiency.py, orchestrated by experiment_runner.py. requirements.txt lists all dependencies; random seeds 2026–2030 reproduce the reported runs. Data availability: this deposit contains code only. The Low Carbon London and GoiEner smart-meter datasets are publicly available from their original providers; access instructions are given in the paper's Data Availability Statement.