pyrdf2vec.embedders.word2vec module

class pyrdf2vec.embedders.word2vec.Word2Vec(**kwargs)

Bases: pyrdf2vec.embedders.embedder.Embedder

Defines the Word2Vec embedding technique.

SEE: https://radimrehurek.com/gensim/models/word2vec.html

_model

The gensim.models.word2vec model. Defaults to None.

kwargs

The keyword arguments dictionary. Defaults to { min_count=0 }.

fit(walks, is_update=False)

Fits the Word2Vec model based on provided walks.

Parameters
  • walks (List[List[Tuple[str, ...]]]) – The walks to create the corpus to to fit the model.

  • is_update (bool) – True if the new walks should be added to old model’s walks, False otherwise. Defaults to False.

Return type

Embedder

Returns

The fitted Word2Vec model.

transform(entities)

The features vector of the provided entities.

Args:

entities: The entities including test entities to create the embeddings. Since RDF2Vec is unsupervised, there is no label leakage.

Return type

List[str]

Returns

The features vector of the provided entities.