synthetic.predictor package

Submodules

synthetic.predictor.adult module

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

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

Bases: Dataset

Pytorch dataset to handle adult data.

__annotations__ = {}
__getitem__(idx)[source]

Fetch ith data point.

Parameters:

idx (int or array of int) – Data index.

__init__(data)[source]

Make data conversion for pytorch integration.

Parameters:

data (pandas.dataframe) – dataset to convert.

__len__()[source]

Length of dataset.

__module__ = 'synthetic.predictor.adult'
__parameters__ = ()
class synthetic.predictor.adult.AdultNN[source]

Bases: object

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

__dict__ = mappingproxy({'__module__': 'synthetic.predictor.adult', '__doc__': 'Wrapper arround pytorch neural network. Interfare for hyper parameter optimisation using raytune.', '__init__': <function AdultNN.__init__>, 'fit': <function AdultNN.fit>, 'predict': <function AdultNN.predict>, '__dict__': <attribute '__dict__' of 'AdultNN' objects>, '__weakref__': <attribute '__weakref__' of 'AdultNN' objects>, '__annotations__': {}})
__init__()[source]
__module__ = 'synthetic.predictor.adult'
__weakref__

list of weak references to the object (if defined)

fit(data)[source]

Train and tune hyper parameters.

Parameters:

data (pandas.dataframe) – 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 TabularNN to predict label of dataset.

Parameters:

data (pandas.dataframe) – Dataset without label.

Returns:

Dataset with labels.

Return type:

pandas.dataframe

class synthetic.predictor.adult.TabularNN(input_size, l1, l2, output_size)[source]

Bases: Module

Pytorch neural network for adult.

__annotations__ = {}
__init__(input_size, l1, l2, output_size)[source]

Sets layers for a neural network.

Parameters:
  • input_size (int) – Number of features.

  • hidden_size (int) – Number of neurons/hidden layer.

  • l1 (int) – Size of the first layer.

  • l2 (int) – Size of the second layer.

  • output_size (int) – Number classes in the labels.

__module__ = 'synthetic.predictor.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