Coder Social home page Coder Social logo

enzeyu / fednh_learn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yutong-dai/fednh

0.0 0.0 0.0 376 KB

Code release for Tackling Data Heterogeneity in Federated Learning with Class Prototypes appeared on AAAI2023.

License: MIT License

Shell 6.11% Python 93.89%

fednh_learn's Introduction

FedNH

This repo provides an implementation of FedNH proposed in for Tackling Data Heterogeneity in Federated Learning with Class Prototypes, which is accepted by AAAI2023. In companion, we also provide our implementation of benchmark algorithms.

Prepare Dataset

Please create a folder data under the root directory.

mkdir ~/data
  • Cifar10, Cifar100: No extra steps are required.

  • TinyImageNet

  • Download the dataset cd ~/data && wget http://cs231n.stanford.edu/tiny-imagenet-200.zip

  • Unzip the file unzip tiny-imagenet-200.zip

Run scripts

We prepared a python file /experiments/gen_script.py to generate bash commands to run experiments.

To reproduce the results for Cifar10/Cifar100, just set the variable purpose to Cifar in the gen_script.py file. Similarly, set purpose to TinyImageNet to run experiments for TinyImageNet.

gen_script.py will create a set of bash files named as [method]_dir.sh. Then use, for example, bash FedAvg.sh to run experiments.

We include a set of bash files to run experiments on Cifar in this submission.

Organization of the code

The core code can be found at src/flbase/. Our framework builds upon three abstrac classes server, clients, and model. And their concrete implementations can be found in models directory and the startegies directory, respectively.

  • src/flbase/models: We implemented or borrowed the implementation of (1) Convolution Neural Network and (2) Resnet18.
  • src/flbase/strategies: We implement CReFF, Ditto, FedAvg, FedBABU, FedNH, FedPer, FedProto, FedRep, FedROD. Each file provides the concrete implementation of the corresponding server class and client class.

Helper functions, for example, generating non-iid data partition, can be found in src/utils.py.

Credits

The code base is developed with extensive references to the following GitHub repos. Some code snippets are directly taken from the original implementation.

  1. FedBABU: https://github.com/jhoon-oh/FedBABU
  2. CReFF: https://github.com/shangxinyi/CReFF-FL
  3. FedROD: https://openreview.net/revisions?id=I1hQbx10Kxn
  4. Personalized Federated Learning Platform: https://github.com/TsingZ0/PFL-Non-IID
  5. FedProxL: https://github.com/litian96/FedProx
  6. NIID-Bench: https://github.com/Xtra-Computing/NIID-Bench
  7. FedProto: https://github.com/yuetan031/fedproto

fednh_learn's People

Contributors

yutong-dai avatar

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.