synthetic_aia_mia.mia package — src documentation

# 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)

  Bases: `Dataset`

  Pytorch dataset to handle aia with soft labels.

class synthetic_aia_mia.mia.ml.MiaNN

  Bases: `object`

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

  fit(dadata)

    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)

    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)

  Bases: `Module`

  Pytorch neural network for adult.

  forward(x)

    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

Membership inference attack.

class synthetic_aia_mia.mia.Mia

  Bases: `object`

  High level interfate for membership inference attack.

  fit(data)

    Fit mia.

    Parameters:

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

  predict(data)

    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)

  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.