SyntacticPlusW2VModel

class mowl.models.SyntacticPlusW2VModel(*args, **kwargs)[source]

Bases: SyntacticModel

Model that combines corpus generation with Word2Vec training.

New in version 0.2.0.

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.

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.

set_w2v_model(*args, **kwargs)

This method sets the gensim.models.word2vec.Word2Vec model to be used in the syntactic model.

train([epochs])

Triggers the Word2Vec training process.

Attributes Documentation

class_embeddings
individual_embeddings
object_property_embeddings

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.

set_w2v_model(*args, **kwargs)[source]

This method sets the gensim.models.word2vec.Word2Vec model to be used in the syntactic model.

Parameters:
  • args – Arguments to be passed to the Word2Vec constructor.

  • kwargs – Keyword arguments to be passed to the Word2Vec constructor.

train(epochs=None)[source]

Triggers the Word2Vec training process.

Parameters:

epochs (int) – Number of epochs to train the model. If None, the value of the epochs parameter passed to the constructor will be used.