You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 8, 2023. It is now read-only.
Hi ,
Thank you for implementing the Shokri et al. attack. I have been reading and repeating the experiment mentioned in the paper. However, I found that all the training dataset for shadow models just using the data records disjoint from target training dataset of specific dataset (like cifar-10) and replacing k features or replacing nothing in the code. Maybe, it could be a little bit different from the original algorithm in the paper.
I wrote the Algorithm 1: Data synthesis using the target model by myself using Pytorch. I generated a random tensor X_tensor as size of (1, 3, 32, 32) for cifar-10 dataset and used two phases --- search and sample as the algorithm 1 in the paper. The code is as below:
def data_synthesize(net, trainset_size, fix_class, initial_record, k_max,
in_channels, img_size, batch_size, num_workers, device):
"""
It is a function to synthesize data
"""
# Initialize X_tensor with an initial_record, with size of (1, in_channels, img_size, img_size)
X_tensor = initial_record
# Generate y_tensor with the size equivalent to X_tensor's
y_tensor = gen_class_tensor(trainset_size, fix_class)
y_c_current = 0 # target models probability of fixed class
j = 0 # consecutive rejections counter
k = k_max # search radius
max_iter = 100 # max iter number
conf_min = 0.1 # min probability cutoff to consider a record member of the class
rej_max = 5 # max number of consecutive rejections
k_min = 1 # min radius of feature perturbation
for _ in range(max_iter):
dataset = TensorDataset(X_tensor, y_tensor)
dataloader = DataLoader(dataset=dataset, batch_size=batch_size, num_workers=num_workers, shuffle=True)
y_c = nn_predict_proba(net, dataloader, device, fix_class)
# Phase 1: Search
if y_c >= y_c_current:
# Phase 2: Sample
if y_c > conf_min and fix_class == torch.argmax(nn_predict(net, dataloader, device), dim=1):
return X_tensor
X_new_tensor = X_tensor
y_c_current = y_c # renew variables
j = 0
else:
j += 1
if j > rej_max: # many consecutive rejects
k = max(k_min, int(np.ceil(k / 2)))
j = 0
X_tensor = rand_tensor(X_new_tensor, k, in_channels, img_size, trainset_size)
return X_tensor, y_c
However, the prediction probability it generates is so low, like 0.1. Could you please give me some guidance on the Data Synthesis Using the Target Model Algorithm or update the uploaded code? Thanks in advance for your patience!
Best wish!
Yantong
The text was updated successfully, but these errors were encountered:
icmpnorequest
changed the title
About Algorithm 1 Data Synthesis Using the Target Model in Shokri's Membership Inference Paper
About Algorithm 1 Data Synthesis Using the Target Model in Shokri et al. Membership Inference Attack
Sep 20, 2019
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi ,
Thank you for implementing the Shokri et al. attack. I have been reading and repeating the experiment mentioned in the paper. However, I found that all the training dataset for shadow models just using the data records disjoint from target training dataset of specific dataset (like cifar-10) and replacing k features or replacing nothing in the code. Maybe, it could be a little bit different from the original algorithm in the paper.
I wrote the Algorithm 1: Data synthesis using the target model by myself using Pytorch. I generated a random tensor X_tensor as size of (1, 3, 32, 32) for cifar-10 dataset and used two phases --- search and sample as the algorithm 1 in the paper. The code is as below:
However, the prediction probability it generates is so low, like 0.1. Could you please give me some guidance on the Data Synthesis Using the Target Model Algorithm or update the uploaded code? Thanks in advance for your patience!
Best wish!
Yantong
The text was updated successfully, but these errors were encountered: