EmbeddingELModel
- class mowl.base_models.EmbeddingELModel(dataset, embed_dim, batch_size, extended=True, model_filepath=None, load_normalized=False, device='cpu')[source]
Bases:
Model
Abstract class for \(\mathcal{EL}\) embedding methods.
- Parameters:
dataset (
mowl.datasets.Dataset
) – mOWL dataset to use for training and evaluation.embed_dim (int) – The embedding dimension.
batch_size (int) – The batch size to use for training.
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 Trueload_normalized (bool, optional) – If True, the ontology is assumed to be normalized and GCIs are extracted directly. Defaults to False.
device (str, optional) – The device to use for training. Defaults to “cpu”.
Changed in version 1.0.0: Added the ‘load_normalized’ parameter.
Attributes Summary
Returns a dictionary with class names as keys and class embeddings as values.
Returns a dictionary with individual names as keys and individual embeddings as values.
Returns a dictionary with object property names as keys and object property embeddings as values.
Returns the testing dataloaders for each GCI type.
Returns the testing datasets for each GCI type.
Returns the training dataloaders for each GCI type.
Returns the training datasets for each GCI type.
Returns the validation dataloaders for each GCI type.
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.
score
(axiom)Returns the score of the given axiom.
Attributes Documentation
- class_embeddings
- head_entities
- individual_embeddings
- object_property_embeddings
- tail_entities
- testing_dataloaders
Returns the testing dataloaders for each GCI type. Each dataloader is an instance of
torch.utils.data.DataLoader
- Return type:
- testing_datasets
Returns the testing datasets for each GCI type. Each dataset is an instance of
mowl.datasets.el.ELDataset
- Return type:
- testing_set
- training_dataloaders
Returns the training dataloaders for each GCI type. Each dataloader is an instance of
torch.utils.data.DataLoader
- Return type:
- training_datasets
Returns the training datasets for each GCI type. Each dataset is an instance of
mowl.datasets.el.ELDataset
- Return type:
- training_set
- validation_dataloaders
Returns the validation dataloaders for each GCI type. Each dataloader is an instance of
torch.utils.data.DataLoader
- Return type:
- validation_datasets
Returns the validation datasets for each GCI type. Each dataset is an instance of
mowl.datasets.el.ELDataset
- Return type:
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.