Model
- class mowl.base_models.Model(dataset, model_filepath=None)[source]
Bases:
object
Abstract model class.
- Parameters:
dataset (mowl.datasets.base.Dataset) – Dataset object.
model_filepath (str, optional) – Path for saving the model. Defaults to a temporary file path.
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.Attributes Summary
Returns a dictionary with class names as keys and class embeddings as values.
Dictionary with class names as keys and class indexes as values.
Returns a dictionary with individual names as keys and individual embeddings as values.
Dictionary with individual names as keys and indexes as values.
Path for saving the model.
Returns a dictionary with object property names as keys and object property embeddings as values.
Dictionary with object property names as keys and object property indexes as values.
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.
eval_fn
(*args, **kwargs)from_pretrained
(file_name)This method loads a pretrained model from a file.
score
(axiom)Returns the score of the given axiom.
train
(*args, **kwargs)Abstract method for training the model.
Attributes Documentation
- class_embeddings
Returns a dictionary with class names as keys and class embeddings as values.
- Return type:
New in version 0.2.0.
- class_index_dict
Dictionary with class names as keys and class indexes as values.
- Return type:
- individual_embeddings
Returns a dictionary with individual names as keys and individual embeddings as values.
- Return type:
New in version 0.2.0.
- individual_index_dict
Dictionary with individual names as keys and indexes as values.
- Return type:
- object_property_embeddings
Returns a dictionary with object property names as keys and object property embeddings as values.
- Return type:
New in version 0.2.0.
- object_property_index_dict
Dictionary with object property names as keys and object property indexes as values.
- 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.
- from_pretrained(file_name)[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.