/collaboration-consensus

Primary LanguagePythonApache License 2.0Apache-2.0

This is the code-implementation for the paper Collaborative learning via Prediction Consensus

Environment

conda env create -f env.yml
conda activate collab-consensus

Data generation

Supported datasets:

Go to datasets folder. For cifar10/100, dirichlet ($\alpha$ = a) distribution is used to create statistical heterogeniety among agents. Bigger $\alpha$ means less non-iidness. For FedISIC2019 dataset, each split corresponds to data collected by different hospitals.

python3 generate_cifar100.py --niid --partition dir --alpha [a] --n_clients [n] --refgen 

Model Training

By default, models are trained with 50 gloabl rounds and 5 local rounds each. Here we offer different combinations for training:

  • Setting:
    • Normal
    • Clients are assigned with two different model architectures
    • Clients with low quality data involved
  • Trust weight update:
    • dynamic
    • static (fixed as first trust calculation throughout training)
    • naive (fixed as 1/N each entry throughout training)
python3 main.py -ds [Cifar10/Cifar100/] -ncl [10] -lam [0.5/0.0] -setting [normal/2sets/evil] -trust [dynamic/static/naive]