synthetic_aia_mia.predictor package

Submodules

synthetic_aia_mia.predictor.adult module

Define structures to manage and interface a fully connected neural network for adult.

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

Bases: Dataset

Pytorch dataset to handle adult data. :param data: dataset to convert. :type data: pandas.dataframe

class synthetic_aia_mia.predictor.adult.AdultNN(overfit=False, loss='entropy', epochs=1000, hyper_sample=40, scale=True, tune=True)[source]

Bases: object

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

Parameters:
  • overfit (bool) – (Optional default=False) Force the model to overfit.

  • loss (string) – Used loss function. Either “entropy” or “mse”.

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 “PINCP” 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

set_config(config)[source]

Set manual configuration.

Parameters:

config (Dictionary) – Hyperparameters for ML.

class synthetic_aia_mia.predictor.adult.TabularNN(input_size, l1, l2, l3, l4, output_size)[source]

Bases: Module

Pytorch neural network for adult. :param input_size: Number of features. :type input_size: int :param hidden_size: Number of neurons/hidden layer. :type hidden_size: int :param l1: Size of the first layer. :type l1: int :param l2: Size of the second layer. :type l2: int :param l3: Size of the third layer. :type l3: int :param l4: Size of the fourth layer. :type l4: int :param output_size: Number classes in the labels. :type output_size: int

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.predictor.utk module

Define structures to manage and interface a fully connected neural network for adult.

class synthetic_aia_mia.predictor.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.predictor.utk.UtkDataset(data)[source]

Bases: Dataset

Pytorch dataset to handle StorageDataset. :param data: dataset to convert. :type data: fetch_data.utk.StorageDataset

class synthetic_aia_mia.predictor.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