Giter Site home page Giter Site logo

lolo1222 / iau Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 21 KB

This is the accompanying code repository for the paper Efficient Machine Unlearning via Influence Approximation by Jiawei Liu, Chenwang Wu, Defu Lian, and Enhong Chen.

Python 99.77% Shell 0.23%

iau's Introduction

Efficient Machine Unlearning via Influence Approximation

This is the accompanying code repository for the paper Efficient Machine Unlearning via Influence Approximation by Jiawei Liu, Chenwang Wu, Defu Lian, and Enhong Chen.

How to run the experiments

Data Preparation:

First, split the CIFAR10 dataset into train/valid set.

python data_train_valid.py

Then divide the parts that need to be forgotten. You can specify the random seed and unlearn ratio.

python data_remain_unlearn.py --seed=1 --ratio=0.05

Model Training:

Traditional Training

Train a CNN model in the full dataset with traditional training to get the initial model. You can change the parameter dataset to remain to get the retrain model, which is the gold model in unlearning. We set the max_epoch, batch_size, and learning_rate to default. You can also specify these value.

python train_model.py --dataset=origin  --seed=1 --ratio=0.05
# python train_model.py --dataset=origin  --seed=1 --ratio=0.05 --epoch=200 --batch_size=64 --lr=0.001

Training With Gradient Restriction Loss

The Gradient Restriction (GR) loss is

$$ \ell_{GR}(x,\theta)=\ell(z,\theta)+\alpha *||\nabla_{\theta}\ell(z,\theta)||_2 $$

We can use the GR loss by setting parameter model_fix_flag to 1. You can specify the value of coefficient $\alpha$.

python train_model.py --dataset=origin  --seed=1 --ratio=0.05 --model_fix_flag=1 --alpha=0.005

Model Unlearning:

Unlearn on the model with GR loss:

python IAU_unlearn.py --dataset=origin  --seed=1 --ratio=0.05 --model_fix_flag=1 --alpha=0.005

It saves the unlearned model as "ul_model/ul_model.pt".

Membership Inference Attack:

First we need to train an attack model.

python generate_mia_data.py
python train_mia.py

Then we use this model to attack the unlearned model:

python mia_attacks.py

iau's People

Contributors

lolo1222 avatar

Stargazers

Bocheng Li avatar

Watchers

 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.