synthetic_aia_mia.mia_synthetic package

Submodules

synthetic_aia_mia.mia_synthetic.adult module

Define structures to manage and interface a fully connected neural network for the mia on synthetic adult.

class synthetic_aia_mia.mia_synthetic.adult.AdultDataset(data)[source]

Bases: Dataset

Pytorch dataset to handle adult data.

class synthetic_aia_mia.mia_synthetic.adult.AdultNN[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 a column called “member” used as training label.

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 hard labels, soft labels and loss.

Return type:

fetch_data.Dataset

class synthetic_aia_mia.mia_synthetic.adult.TabularNN(input_size, l1, l2, l3, l4, 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_synthetic.utk module

Define structures to manage and interface a CNN for mia on synthetic utk.

class synthetic_aia_mia.mia_synthetic.utk.CNN(c1, c2, l)[source]

Bases: Module

Convolutional neural network for 50x50x3 images.

Parameters:
  • c1 (int) – Output number of channels of the first convolution layer.

  • c2 (int) – Output number of channels of the second convolution layer.

Param:

Linear size.

forward(x)[source]

Forward pass of the cnn.

Parameters:

x (torch.tenort) – Input batch.

class synthetic_aia_mia.mia_synthetic.utk.UtkDataset(data)[source]

Bases: Dataset

Pytorch dataset to handle StorageDataset.

class synthetic_aia_mia.mia_synthetic.utk.UtkNN(epochs=500)[source]

Bases: object

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

Parameters:

epochs (int) – Number of epochs.

fit(data)[source]

Train and tune hyper parameters.

Parameters:

data – Dataset the will be split for training and hyper parameter tuning. Dataset must contain a column called “PINCP” used as training label.

predict(data)[source]

Use a trained CNN to predict label of dataset.

Parameters:

dadata (fetch_data.utk.StorageDataset) – Dataset to evaluate.

Returns:

Input dataset completed with hard labels, soft labels and loss.

Return type:

fetch_data.Dataset

Module contents