fjxmlzn / DoppelGANger

[IMC 2020 (Best Paper Finalist)] Using GANs for Sharing Networked Time Series Data: Challenges, Initial Promise, and Open Questions
http://arxiv.org/abs/1909.13403
BSD 3-Clause Clear License
293 stars 75 forks source link

membership_inference_attack #24

Closed fxctydfty closed 3 years ago

fxctydfty commented 3 years ago

Hey, I am trying to reproduce the Figure-15. Is it possible to share the source code for membership inference attacks from your paper. Thanks in advance for your help.

fjxmlzn commented 3 years ago

This is the code snippet is here

# After GAN is trained

# Load the final checkpoint
gan.load()

# train_data_feature, train_data_attribute are loaded from https://github.com/fjxmlzn/DoppelGANger/blob/e732a4d077ba1504e6e401df9c2d1048c8efb2a9/example_training/gan_task.py#L20-L45 
d_train = gan.discriminate_from(
    [train_data_feature], [train_data_attribute])

# test_data_feature, test_data_attribute are loaded by the same way, except passing flag="test" to load_data
d_test = gan.discriminate_from(
    [test_data_feature], [test_data_attribute])

num_train = train_data_feature.shape[0]

sort_id = np.argsort(list(d_train) + list(d_test))[::-1]

acc = np.where(sort_id[0: num_train] < num_train)[0].shape[0] / float(num_train)
fxctydfty commented 3 years ago

What is "acc" meaning here?

fjxmlzn commented 3 years ago

The attack accuracy, y-axis of Figure 15

fxctydfty commented 3 years ago

Thanks.

fxctydfty commented 3 years ago

Hey, I need some help. I understand from here # train_data_feature, train_data_attribute are loaded from https://github.com/fjxmlzn/DoppelGANger/blob/e732a4d077ba1504e6e401df9c2d1048c8efb2a9/example_training/gan_task.py#L20-L45 Could you please explain little bit before that like, "load and call DoppleGANger". Thanks for your help.

fjxmlzn commented 3 years ago

What I meant is that you can just append these codes at the end of https://github.com/fjxmlzn/DoppelGANger/blob/master/example_training/gan_task.py, where DoppelGANger is trained