mowl.base_models

Base model

class mowl.base_models.model.Model(dataset, model_filepath=None)[source]

Bases: object

Changed in version 0.1.0: Parameter model_filepath added in the base class for all models. Optional parameter that will use temporary files in case it is not set.

train()[source]

Abstract method for training the model. This method must be implemented in child classes

property model_filepath

Path for saving the model.

Return type

str

property class_index_dict

Dictionary with class names as keys and class indexes as values.

Return type

dict

property individual_index_dict

Dictionary with individual names as keys and indexes as values.

Return type

dict

property object_property_index_dict

Dictionary with object property names as keys and object property indexes as values.

Return type

dict

class mowl.base_models.model.EmbeddingModel(*args, **kwargs)[source]

Bases: Model

Base \(\mathcal{EL}\) model

class mowl.base_models.elmodel.EmbeddingELModel(dataset, batch_size, extended=True, model_filepath=None, device='cpu')[source]

Bases: EmbeddingModel

Abstract class that provides basic functionalities for methods that aim to embed EL language.

Parameters

extended (bool, optional) – If True, the model is supposed with 7 EL normal forms. This will be reflected on the DataLoaders that will be generated and also the model must contain 7 loss functions. If False, the model will work with 4 normal forms only, merging the 3 extra to their corresponding origin normal forms. Defaults to True

property training_datasets

Returns the training datasets for each GCI type. Each dataset is an instance of mowl.datasets.el.ELDataset

Return type

dict

property validation_datasets

Returns the validation datasets for each GCI type. Each dataset is an instance of mowl.datasets.el.ELDataset

Return type

dict

property testing_datasets

Returns the testing datasets for each GCI type. Each dataset is an instance of mowl.datasets.el.ELDataset

Return type

dict

property training_dataloaders

Returns the training dataloaders for each GCI type. Each dataloader is an instance of torch.utils.data.DataLoader

Return type

dict

property validation_dataloaders

Returns the validation dataloaders for each GCI type. Each dataloader is an instance of torch.utils.data.DataLoader

Return type

dict

property testing_dataloaders

Returns the testing dataloaders for each GCI type. Each dataloader is an instance of torch.utils.data.DataLoader

Return type

dict