backbones package

Subpackages

Submodules

backbones.genericBackbone module

class backbones.genericBackbone.GenericBackbone(config)

Bases: ABC

Abstract base class for the generic backbone. Stablishes the building functions of the specific backbones as abstract methods.

abstract implement_model()
abstract inference(model)
abstract load_data()
abstract test(model)
abstract train()

backbones.pyodBackbone module

class backbones.pyodBackbone.PyodBackbone(config)

Bases: GenericBackbone

Backbone for Python Outlier Detection models

Parameters:

GenericBackbone (class) – GenericBackbone class

implement_model()

Python Outlier Detection model implementation

inference()

Inference stage

load_data()

Load train, validation and test datasets.

test()

Test stage

train()

Training (res_train) and validation (res_val) stages

Returns:

Trained model

Return type:

PyodModel

backbones.pytorchBackbone module

class backbones.pytorchBackbone.PytorchBackbone(config)

Bases: GenericBackbone

Class that implements the family of PyTorch models and defines the generic backbone functions specific to them

Parameters:

config (dict) – configuration file

implement_model()

Defines and implements the PyTorch model along with the checkpoint and early stopping PyTorch Lightning callbacks and the tensorboard logger. These are feed to the PyTorch Lightning class, “Trainer”, which automates: 1) enabling/disabling gradients, 2) running the training, validation and test dataloaders 3) calling the Callbacks at the appropriate times 4) putting batches and computations on the correct devices

inference(subset='test')

Calls the inference stage for the model

Parameters:

subset (str, optional) – period in which inference should be performed, defaults to ‘test’

Returns:

inference results

Return type:

dict

load_data()

Loads the PyTorch Datasets for training, validation and testing and creates the corresponding PyTorch’s Dataloader classes

test()

Calls the testing stage for the model

train()

Calls for the training of the model from scratch or to load a pretrained model

Returns:

PyTorch model

Return type:

torch.nn.Module

Module contents