pyrdf2vec.walkers.ngram module

class pyrdf2vec.walkers.ngram.NGramWalker(max_depth, max_walks=None, sampler=NOTHING, n_jobs=None, *, with_reverse=False, random_state=None, md5_bytes=8, grams=3, wildcards=None)

Bases: pyrdf2vec.walkers.random.RandomWalker

N-Gram walking strategy which relabels the n-grams in random walks to define a mapping from one-to-many. The intuition behind this is that the predecessors of a node that two different walks have in common can be different.

_is_support_remote

True if the walking strategy can be used with a remote Knowledge Graph, False Otherwise Defaults to True.

_n_gram_map

Stores the mapping of N-gram. Defaults to {}.

grams

The N-gram to relabel. Defaults to 3.

kg

The global KG used later on for the worker process. Defaults to None.

max_depth

The maximum depth of one walk.

max_walks

The maximum number of walks per entity. Defaults to None.

random_state

The random state to use to keep random determinism with the walking strategy. Defaults to None.

sampler

The sampling strategy. Defaults to UniformSampler.

wildcards

The wildcards to be used to match sub-sequences with small differences to be mapped onto the same label. Defaults to None.