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 the evaluation model.
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)evaluate
(*args, **kwargs)from_pretrained
(file_name)This method loads a pretrained model from a file.
score
(axiom)Returns the score of the given axiom.
set_evaluator
(evaluator, *args, **kwargs)This method sets the evaluator for the model.
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:
Added in version 0.2.0.
- class_index_dict
Dictionary with class names as keys and class indexes as values.
- Return type:
- evaluation_model
Returns the evaluation model. In models relying on Word2Vec embeddings, this method calls an auxiliary evaluation model for scoring. Methods using KGEs or Geometric Embeddings would return the model itself.
Added in version 1.0.0.
- individual_embeddings
Returns a dictionary with individual names as keys and individual embeddings as values.
- Return type:
Added in version 0.2.0.
- individual_index_dict
Dictionary with individual names as keys and indexes as values.
- Return type:
- metrics
Added in version 1.0.0.
- object_property_embeddings
Returns a dictionary with object property names as keys and object property embeddings as values.
- Return type:
Added 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.
Added 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.
Added in version 0.2.0.
- score(axiom)[source]
Returns the score of the given axiom.
- Parameters:
axiom (
org.semanticweb.owlapi.model.OWLAxiom
) – The axiom to score.
Added in version 0.2.0: Axiom scoring method added to the base class.
- set_evaluator(evaluator, *args, **kwargs)[source]
This method sets the evaluator for the model.
- Parameters:
evaluator (mowl.evaluation.base.Evaluator) – Evaluator object.
Added in version 1.0.0.