EmbeddingELModel

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

Bases: Model

Abstract class for \(\mathcal{EL}\) embedding methods.

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

Attributes Summary

class_embeddings

Returns a dictionary with class names as keys and class embeddings as values.

individual_embeddings

Returns a dictionary with individual names as keys and individual embeddings as values.

object_property_embeddings

Returns a dictionary with object property names as keys and object property embeddings as values.

testing_dataloaders

Returns the testing dataloaders for each GCI type.

testing_datasets

Returns the testing datasets for each GCI type.

training_dataloaders

Returns the training dataloaders for each GCI type.

training_datasets

Returns the training datasets for each GCI type.

validation_dataloaders

Returns the validation dataloaders for each GCI type.

validation_datasets

Returns the validation datasets for each GCI type.

Methods Summary

add_axioms(*axioms)

This method adds axioms to the dataset contained in the model and reorders the embedding information for each entity accordingly.

from_pretrained(model)

This method loads a pretrained model from a file.

init_module()

score(axiom)

Returns the score of the given axiom.

Attributes Documentation

class_embeddings
individual_embeddings
object_property_embeddings
testing_dataloaders

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

Return type:

dict

testing_datasets

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

Return type:

dict

training_dataloaders

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

Return type:

dict

training_datasets

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

Return type:

dict

validation_dataloaders

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

Return type:

dict

validation_datasets

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

Return type:

dict

Methods Documentation

add_axioms(*axioms)[source]

This method adds axioms to the dataset contained in the model and reorders the embedding information for each entity accordingly. New entites are initalized with random embedding.

Parameters:

axioms (org.semanticweb.owlapi.model.OWLAxiom) – Axioms to be added to the dataset.

New in version 0.2.0.

from_pretrained(model)[source]

This method loads a pretrained model from a file.

Parameters:

file_name (str) – Path to the pretrained model file.

New in version 0.2.0.

init_module()[source]
score(axiom)[source]

Returns the score of the given axiom.

Parameters:

axiom (org.semanticweb.owlapi.model.OWLAxiom) – The axiom to score.

New in version 0.2.0.