Giter VIP home page Giter VIP logo

poisoning-attacks-wireless-traffic-prediction's Introduction

Acknowledgment

The code is written based on the Zhang et al's code, and still under polishment.

Download the dataset

The dataset can be manually downloaded from Google Drive

After downloading the .h5 files, put those files into a directory named dataset and put the directory under the main directory before running the code.

Train centralized model

python centralized.py --file milano.h5 --type sms --lr 1e-2 --frac 0.1 --bs 100 --opt 'sgd' --out_dim 1 --epochs 10 --batch_size 50

Centrailized File: milano.h5 Type: sms MSE: 0.3171 MAE: 0.3223, NRMSE: 0.0908

Uniform noise for comparison

python centralized.py --file milano.h5 --type sms --lr 1e-2 --frac 0.1 --bs 100 --opt 'sgd' --out_dim 1 --poison --attack_epsilon 0.2 --attack_optimizer uniform

Data poisoning against centralized model training

python centralized.py --file milano.h5 --type sms --lr 1e-2 --frac 0.1 --bs 100 --opt 'sgd' --out_dim 1 --poison --attack_epsilon 0.2 --num_ensemble 2 --attack_rounds 30 --epochs 10 --batch_size 50 --attack_lr 10.0 --mask_prob 0.8 --surrogate_model lstm

Apply defense to data poisoning (Data Sanitization, Randomized Smoothing)

python centralized.py --file milano.h5 --type sms --lr 1e-2 --frac 0.1 --bs 100 --opt 'sgd' --out_dim 1 --poison --attack_epsilon 0.2 --num_ensemble 2 --attack_rounds 30 --epochs 10 --batch_size 50 --attack_lr 10.0 --mask_prob 0.8 --surrogate_model lstm --apply_defense sphere_sani
python centralized.py --file milano.h5 --type sms --lr 1e-2 --frac 0.1 --bs 100 --opt 'sgd' --out_dim 1 --poison --attack_epsilon 1.0 --num_ensemble 2 --attack_rounds 20 --epochs 10 --batch_size 50 --attack_lr 10.0 --mask_prob 0.8 --surrogate_model lstm --apply_defense adj_sani
python centralized.py --file milano.h5 --type sms --lr 1e-2 --frac 0.1 --bs 100 --opt 'sgd' --out_dim 1 --poison --attack_epsilon 1.0 --num_ensemble 2 --attack_rounds 20 --epochs 10 --batch_size 50 --attack_lr 10.0 --mask_prob 0.8 --surrogate_model lstm --apply_defense rand

Train FedAvg model

python fed_avg.py --file milano.h5 --type sms --lr 1e-2 --frac 0.1 --bs 100 --opt 'sgd' --out_dim 1

Type: sms MSE: 0.3744 MAE: 0.3386, NRMSE: 0.0955

Model poisoning against FedAvg

python fed_avg.py --file milano.h5 --type sms --lr 1e-2 --frac 0.1 --bs 100 --opt 'sgd' --out_dim 1 --poison

Apply defenses (Multi Krum, Trimmed Mean)

python fed_avg.py --file milano.h5 --type sms --lr 1e-2 --frac 0.1 --bs 100 --opt 'sgd' --out_dim 1 --poison --apply_defense multi_krum
python fed_avg.py --file milano.h5 --type sms --lr 1e-2 --frac 0.1 --bs 100 --opt 'sgd' --out_dim 1 --poison --apply_defense trimmed_mean
python fed_avg.py --file milano.h5 --type sms --lr 1e-2 --frac 0.1 --bs 100 --opt 'sgd' --out_dim 1 --poison --apply_defense median

poisoning-attacks-wireless-traffic-prediction's People

Contributors

tianzheng4 avatar

Stargazers

 avatar

Forkers

tianzheng4

poisoning-attacks-wireless-traffic-prediction's Issues

Reproducibility issue

Hi @tianzheng4,
Thanks for sharing the code and congratulations for your interesting work.
However, it seems that we still could not control all the randomness in the code with seed settings.
On the conda environment created from the provided environment.yml, different runs might result in different MSE, MAE, NRMS values, especially when attacks and defenses are involved.
Do you have any suggestions here?
Thank you!

Package versions

Hi @tianzheng4 ,
Thanks for sharing this repository.
I'm having some compatibility issues with the package versions installed.
Could you please share the versions of packages or the .yml file of the environment required to run the scripts?
Many thanks!

No module named 'redundant.train_utils'

Hi, I'm getting this error. There's some modules missing:

from redundant.train_utils import normal_weight_init
ModuleNotFoundError: No module named 'redundant.train_utils'

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.