synthetic_aia_mia.mia package

Submodules

synthetic_aia_mia.mia.ml module

Define structures to manage and interface a fully connected neural network for membership inference attack.

class synthetic_aia_mia.mia.ml.AiaDataset(data)[source]

Bases: Dataset

Pytorch dataset to handle aia with soft labels.

class synthetic_aia_mia.mia.ml.MiaNN[source]

Bases: object

Wrapper arround pytorch neural network. Interfare for hyper parameter optimisation using raytune.

fit(dadata)[source]

Train and tune hyper parameters.

Parameters:

data – Dataset the will be split for training and hyper parameter tuning. Dataset must contain columns called “loss” used as features and “member” used as labels.

predict(dadata)[source]

Use a trained TabularNN to predict label of dataset.

Parameters:

dadata (fetch_data.Dataset) – Dataset to evaluate.

Returns:

Input dataset completed with mia result as a column called “mia”.

Return type:

fetch_data.Dataset

class synthetic_aia_mia.mia.ml.TabularNN(input_size, l1, l2, output_size)[source]

Bases: Module

Pytorch neural network for adult.

forward(x)[source]

Forward pass in the neural network.

Parameters:

x (torch.tensor) – Data points.

Returns:

Neural network function applied to x.

Return type:

torch.tensor

synthetic_aia_mia.mia.rf module

MIA using a random forest.

class synthetic_aia_mia.mia.rf.MiaRF[source]

Bases: object

Wrapper arround sklearn random forest

fit(dadata)[source]

Train a random forest.

Parameters:

data – Dataset the will be used for training. Dataset must contain columns called “loss” used as features and “member” used as labels.

predict(dadata)[source]

Use a trained TabularNN to predict label of dataset.

Parameters:

dadata (fetch_data.Dataset) – Dataset to evaluate.

Returns:

Input dataset completed with mia result as a column called “mia”.

Return type:

fetch_data.Dataset

Module contents

Membership inference attack.

class synthetic_aia_mia.mia.Mia[source]

Bases: object

High level interfate for membership inference attack.

fit(data)[source]

Fit mia.

Parameters:

data (fetch_data.Dataset) – Datatset with member and non member labeled.

predict(data)[source]

Add membership status prediction.

Parameters:

data (fetch_data.Dataset) – Dataset with loss.

Returns:

Dataset with predicted membership status.

Return type:

fetch_data.Dataset

synthetic_aia_mia.mia.random_fusion(train, test)[source]

Sample as many data points from train as they are in test. Then shuffle the sample and test to obtain a new dataset with as many train examples than test.

Parameters:
  • train (fetch_data.DataSet) – Member dataset.

  • test (fetch_data.DataSet) – Non member dataset.

synthetic_aia_mia.mia.random_fusion_storage(train, test)[source]

Same as mia.random_fusion but for storage dataset.

Parameters:
  • train (fetch_data.utk.StorageDataset) – Member dataset.

  • test (fetch_data.utk.StorageDataset) – Non member dataset.