pyrdf2vec package¶
Subpackages¶
- pyrdf2vec.embedders package
- pyrdf2vec.graphs package
- pyrdf2vec.samplers package
- pyrdf2vec.utils package
- pyrdf2vec.walkers package
- Submodules
- pyrdf2vec.walkers.anonymous module
- pyrdf2vec.walkers.community module
- pyrdf2vec.walkers.halk module
- pyrdf2vec.walkers.ngram module
- pyrdf2vec.walkers.random module
- pyrdf2vec.walkers.split module
- pyrdf2vec.walkers.walker module
- pyrdf2vec.walkers.walklet module
- pyrdf2vec.walkers.weisfeiler_lehman module
- Module contents
- Submodules
Submodules¶
Module contents¶
- class pyrdf2vec.RDF2VecTransformer(embedder=NOTHING, walkers=NOTHING, *, verbose=0)¶
Bases:
object
Transforms nodes in a Knowledge Graph into an embedding.
- _embeddings¶
All the embeddings of the model. Defaults to [].
- _entities¶
All the entities of the model. Defaults to [].
- _is_extract_walks_literals¶
True if the session must be closed after the call to the transform function. False, otherwise. Defaults to False.
- _literals¶
All the literals of the model. Defaults to [].
- _pos_entities¶
The positions of existing entities to be updated. Defaults to [].
- _pos_walks¶
The positions of existing walks to be updated. Defaults to [].
- _walks¶
All the walks of the model. Defaults to [].
- embedder¶
The embedding technique. Defaults to Word2Vec.
- walkers¶
The walking strategies. Defaults to [RandomWalker(2, None)]
- verbose¶
The verbosity level. 0: does not display anything; 1: display of the progress of extraction and training of walks; 2: debugging. Defaults to 0.
- fit(kg, entities, is_update=False)¶
Fits the embeddings based on the provided entities.
- Parameters
- Return type
- Returns
The RDF2VecTransformer.
- fit_transform(kg, entities, is_update=False)¶
Creates a model and generates embeddings and literals for the provided entities.
- get_walks(kg, entities)¶
Gets the walks of an entity based on a Knowledge Graph and a list of walkers
- Parameters
- Return type
- Returns
The walks for the given entities.
- Raises
ValueError – If the provided entities aren’t in the Knowledge Graph.
- static load(filename='transformer_data')¶
Loads a RDF2VecTransformer object.
- Parameters
filename (
str
) – The binary file to load the RDF2VecTransformer object.- Return type
- Returns
The loaded RDF2VecTransformer.
- save(filename='transformer_data')¶
Saves a RDF2VecTransformer object.