synthetic_aia_mia.aia package¶
Submodules¶
synthetic_aia_mia.aia.rf module¶
MIA using a random forest.
- class synthetic_aia_mia.aia.rf.AiaRF[source]¶
Bases:
object
Wrapper arround sklearn random forest
- fit(dadata, attrib)[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:
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:
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:
- 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:
- 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: