backbones package
Subpackages
- backbones.models package
- Submodules
- backbones.models.pyodModel module
- backbones.models.pytorchModel module
PytorchModelPytorchModel.adapt_variables_for_metric()PytorchModel.configure_optimizers()PytorchModel.define_model()PytorchModel.epoch_metrics()PytorchModel.forward()PytorchModel.log_metric()PytorchModel.on_test_epoch_end()PytorchModel.on_train_epoch_end()PytorchModel.on_validation_epoch_end()PytorchModel.shared_step()PytorchModel.step_metrics()PytorchModel.test_step()PytorchModel.training_step()PytorchModel.validation_step()
- Module contents
Submodules
backbones.genericBackbone module
- class backbones.genericBackbone.GenericBackbone(config)
Bases:
ABCAbstract 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:
GenericBackboneBackbone 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
backbones.pytorchBackbone module
- class backbones.pytorchBackbone.PytorchBackbone(config)
Bases:
GenericBackboneClass 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