GithubHelp home page GithubHelp logo

chamathpali / fedsim Goto Github PK

View Code? Open in Web Editor NEW
22.0 1.0 0.0 37.89 MB

Similarity Guided Model Aggregation for Federated Learning

Python 88.01% Shell 3.54% Jupyter Notebook 8.44%
federated-learning deep-learning machine-learning privacy-preserving-machine-learning

fedsim's Introduction

FedSim

Similarity Guided Model Aggregation for Federated Learning

This work is published at the Neurocomputing Journal FedSim: Similarity guided model aggregation for Federated Learning

Bibtext

@article{palihawadana2021fedsim,
  title={FedSim: Similarity guided model aggregation for Federated Learning},
  author={Palihawadana, Chamath and Wiratunga, Nirmalie and Wijekoon, Anjana and Kalutarage, Harsha},
  journal={Neurocomputing},
  year={2021},
  publisher={Elsevier}
}

Usage

bash run_fedsim.sh DATASET_NAME DROP_PERC NUM_CLUSTERS NUM_CLIENTS Run_Name
bash run_fedsim.sh mnist 0 9 20 mnist_run

FedSim algorithm implementation is available in flearn/trainers/fedsim.py.

Reproduce results

The experiments performed on all the datasets were carried out with 35 random seeds (from 0 to 34 incremented by 1) to empirically demonstrate the significance. Repetition of the same experiment with different random seeds helps to reduce the sampling error of our experiments.

For a single dataset, run rounds of FedSim, FedAvg and FedProx where each run will generate a single folder in the logs folder, as a reference we have added a sample log folder with the results in logs/sample/

Used hyper parameters for the experiments are presented in Table 2.

Once the experiments are completed, create the summary log files with the 3 methods as in results/ folder. We have added our results in here which can help to refer and use FedSim.

  1. Figure 3 - Results on real datasets - plot_fedsim_main.py

  2. Figure 5 - Accuracy improvements of FedSim - plot_fedsim_improvements.py

  3. Figure 6 - Results on synthetic datasets - plot_fedsim_main.py change line #123 to if(True)

  4. Figure 7 - Results on other learning models - plot_fedsim_other.py

Experiment setup

We have adapted the experiment setup from FedProx and Leaf Benchmark work. Thanks for the support by Tian Li.

Dataset generation

For all datasets, see the README files in separate data/$dataset folders for instructions on preprocessing and/or sampling data.

For further clarifications follow the guides on FedProx and Leaf

The two datasets produced with this work is published with the generation source code.

Downloading dependencies

pip3 install -r requirements.txt  

Run FedSim Experiments

bash run_fedsim.sh DATASET_NAME 0 NUM_CLUSTERS NUM_CLIENTS Run_Name
bash run_fedavg.sh mnist 0 9 20 mnist_run

or direcly use the python command

python3  -u main.py --dataset='goodreads' --optimizer='fedsim' --learning_rate=0.0001 
--num_rounds=250 --clients_per_round=20 --eval_every=1 --batch_size=10 --num_epochs=10 
--model='rnn' --drop_percent=0 --num_groups=11 --ex_name=goodreads_rnn_0 --seed=0

When running on GPU specify the id and then run the experiments

export CUDA_VISIBLE_DEVICES=GPU_ID

Results

Figure 3: Comparison of performances over communication rounds with real-world datasets

Figure 5: Accuracy improvements of FedSim compared to FedAvg and FedProx of experiments in Figure 3. Values below zero indicate negative performance against a baseline and grey vertical lines denote areas of no statistical significance

fedsim's People

Contributors

chamathpali avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

fedsim's Issues

can't setup the requirements.txt

Hi, when I ran pip3 install -r requirements.txt in my anaconda ,an error showed up and I can't do anything moreover.
what could I do ?
err

Code failed to run

Hello, after I installed the environment according to what you said, the code cannot run and there are always missing things. But my python version is 3.7.13. But it seems that it is not a problem with the python version, but because there is no corresponding file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.