synthetic_aia_mia.aia package

Submodules

synthetic_aia_mia.aia.soft module

Define structures to manage and interface a fully connected neural network for attribute inference attack using soft labels.

class synthetic_aia_mia.aia.soft.AiaDataset(data)[source]

Bases: Dataset

Pytorch dataset to handle aia with soft labels.

class synthetic_aia_mia.aia.soft.AiaNN[source]

Bases: object

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

fit(dadata, attrib)[source]

Train and tune hyper parameters.

Parameters:
  • data – Dataset the will be split for training and hyper parameter tuning. Dataset must contain columns called “soft0” and “soft1” used as features.

  • attrib (str) – Sensitive attribute to attack. A column of dadata.

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.aia.soft.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

Module contents

Attribute inference attack.

class synthetic_aia_mia.aia.Aia[source]

Bases: object

High level interface for attribute inference attack. Execute soft and hard attack.

fit(data)[source]

Fit aia for hard and soft labels.

Parameters:

data (fetch_data.Dataset) – Dataset containing labels.

predict(data)[source]

Add sensitive attribute predicton for hard and soft labels.

Parameters:

data (fetch_data.Dataset) – Dataset containing labels.

Returns:

Dataset with predicted sensitive attribute.

Return type:

fetch_data.Dataset

class synthetic_aia_mia.aia.Hard[source]

Bases: object

Attribute inference attack of hard labels for adult.

fit(dadata)[source]

Fit a finit classifier to predict sensitive attribute from hard labels.

Parameters:

dadata (fetch_data.Dataset) – Auxiliary data for aia training.

predict(dadata)[source]

Use previously trained finit classifier to infer senstivies attribute and append prediction to input data.

Parameters:

dadata (fetch_data.Dataset) – Auxiliary data for aia evaluation.

Returns:

Dataset with aia prediction under the columns “sexAIAhard” and “raceAIAhard”.

Return type:

fetch_data.Dataset

class synthetic_aia_mia.aia.Soft[source]

Bases: object

Attribute inference attack of soft labels for adult.

fit(dadata)[source]

Fit a neural network to predict sensitive attribute from soft labels.

Parameters:

dadata (fetch_data.Dataset) – Auxiliary data for aia training.

predict(dadata)[source]

Use previously trained neural network to infer senstivies attribute and append prediction to input data.

Parameters:

dadata (fetch_data.Dataset) – Auxiliary data for aia evaluation.

Returns:

Dataset with aia prediction under the columns “sexAIAsoft” and “raceAIAsoft”.

Return type:

fetch_data.Dataset