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:
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:
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:
- 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.