/LCFL

Loss based Clustered Federated Learning (LCFL)

Primary LanguagePython

Novel clustered federated learning based on local loss (LCFL)

Introduction

This is the code for the paper [Novel clustered federated learning based on local loss] (to add link).

The code is based on a simulation framework for federated learning fl-sim.

Requirements

To install requirements:

pip install -r requirements.txt

Usage

One can use the code in a Jupyter notebook or in command line as follows:

fl-sim configs/lcfl-rot-mnist.yml

or run in background using:

mkdir -p .logs
nohup fl-sim configs/lcfl-rot-mnist.yml > .logs/lcfl-rot-mnist.log 2>&1 & echo $! > .logs/lcfl-rot-mnist.pid

Inspection of the results

One can use the Panel widget to inspect the results in a Jupyter notebook:

%load_ext autoreload
%autoreload 2

from fl_sim.utils.viz import Panel

panel = Panel()

Results

ALL experiments were repeated 5 times with different random seeds.

Experiments on the RotatedMNIST dataset

1200 clients - ACC 1200 clients - loss
RotatedMNIST-1200-acc RotatedMNIST-1200-loss
2400 clients - ACC 2400 clients - loss
RotatedMNIST-2400-acc RotatedMNIST-2400-loss

Experiments on the RotatedCIFAR10 dataset

dynamic transforms - ACC dynamic transforms - loss
RotatedCIFAR10-dt-acc RotatedCIFAR10-dt-loss
no transforms - ACC no transforms - loss
RotatedMNIST-nt-acc RotatedMNIST-nt-loss

v.s. other norms

FEMNIST RotatedMNIST
FEMNIST RotatedMNIST

Citation

If you find this code useful, please cite our paper:

@article{gu2024_LCFL,
    title = {Novel clustered federated learning based on local loss},
   author = {Endong Gu and Yongxin Chen and Hao Wen and Xingju Cai and Deren Han},
  journal = {arXiv preprint arXiv:2407.09360v1},
     year = {2024},
    month = {7},
      doi = {10.48550/arXiv.2407.09360}
}