Git Product home page Git Product logo

lotteryfl's Introduction

LotteryFL: Empower Edge Intelligence with Personalized and Communication-Efficient Federated Learning

This repository is the official implementation of "LotteryFL: Empower Edge Intelligence with Personalized and Communication-Efficient Federated Learning".

Requirements

To install requirements:

pip install -r requirements.txt

Dataset supported

All the datasets should be downloaded in "./data/"

MNIST (--mnist_extr_noniid for sample limited unbalanced non-iid settings)
CIFAR10 (--cifar10_extr_noniid for sample limited unbalanced non-iid settings)
FEMNIST (--femnist)
Fashion-MNIST (--fmnist)
UCI-HAR (--HAR)
USC-HAD (--HAD)

Training

To train the model(s) with Non-iid MNIST Dataset in the paper, run this command:

python lotteryFL.py --model=cnn --dataset=mnist_extr_noniid --gpu=1 --iid=0 --epochs=400 --prune_percent=20 --prune_start_acc=0.5 --prune_end_rate=0.1 --lr=0.01 --local_bs=32 --num_users=400 --frac=0.05 --nclass=2 --nsamples=20 --rate_unbalance=1.0

To train the model(s) with Non-iid CIFAR10 Dataset in the paper, run this command:

python lotteryFL.py --model=cnn --dataset=cifar10_extr_noniid --gpu=1 --iid=0 --epochs=2000 --prune_percent=20 --prune_start_acc=0.1 --prune_end_rate=0.5 --lr=0.01 --local_bs=32 --num_users=400 --frac=0.05 --nclass=2 --nsamples=20 --rate_unbalance=1.0

To train the model(s) with EMNIST Dataset in the paper, run this command:

python lotteryFL.py --model=cnn --dataset=femnist --gpu=1 --iid=0 --epochs=2000 --prune_percent=20 --prune_start_acc=0.5 --prune_end_rate=0.1 --lr=0.01 --local_bs=32 --num_users=2424 --frac=0.05

To train the model(s) with HAR Dataset, run this command:

python lotteryFL.py --dataset=HAR --prune_percent=30 --prune_start_acc=0.7 --model=mlp_general --gpu=0 --num_users=30 --frac=0.33

To run FedAvg, use fedavg.py with the same arguments(The useless arguments for FedAvg would be ignored).

important options:

--prune_percent:    fixed pruning rate r_p
--prune_start_acc:  acc_threshold
--prune_end_rate:   target pruning rate r_target
--rate_unbalance:   unbalance rate of non-iid MNIST and CIFAR10 dataset
--nsamples:         number of samples per class distributed to clients (for mnist_extr_noniid and cifar10_extr_noniid)
--num_samples:      number of samples per class distributed to clients (for HAR)
--num_users:        number of users (not larger than 30 for HAR)

Comments:

Current version of code might prune the local models slightly sparser than "prune_end_rate" because of the logic in line 138 of lotteryFL.py. But it does not hurt significantly.

lotteryfl's People

Contributors

charleslipku 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.