walk_length (int) – Number of nodes in each walk, optional(default: 80)
num_walks (int) – Number of walks per node, optional(default: 10)
skip_gram_params (dict) – Parameters for gensim.models.Word2Vec - do not supply size, it is taken from the dimensions parameter
Returns:
embedding_vector (dict) – The embedding vector of each node
most_similar_nodes_of_node (dict) – The most similar nodes of each node and its similarity
Examples
>>> deepwalk(G,... dimensions=128,# The graph embedding dimensions.... walk_length=80,# Walk length of each random walks.... num_walks=10,# Number of random walks.... skip_gram_params=dict(# The skip_gram parameters in Python package gensim.... window=10,... min_count=1,... batch_words=4,... iter=15... ))
Although the recipe for forward pass needs to be defined within
this function, one should call the Module instance afterwards
instead of this since the former takes care of running the
registered hooks while the latter silently ignores them.
walk_length (int) – Number of nodes in each walk, optional(default: 80)
num_walks (int) – Number of walks per node, optional(default: 10)
p (float) – The return hyper parameter, optional(default: 1.0)
q (float) – The input parameter, optional(default: 1.0)
weight_key (string or None (default: None)) – On weighted graphs, this is the key for the weight attribute
workers (int or None, optional(default : None)) – The number of workers generating random walks (default: None). None if not using only one worker.
skip_gram_params (dict) – Parameters for gensim.models.Word2Vec - do not supply ‘size’, it is taken from the ‘dimensions’ parameter
Returns:
embedding_vector (dict) – The embedding vector of each node
most_similar_nodes_of_node (dict) – The most similar nodes of each node and its similarity
Examples
>>> node2vec(G,... dimensions=128,# The graph embedding dimensions.... walk_length=80,# Walk length of each random walks.... num_walks=10,# Number of random walks.... p=1.0,# The `p` possibility in random walk in [1]_... q=1.0,# The `q` possibility in random walk in [1]_... weight_key='weight',... skip_gram_params=dict(# The skip_gram parameters in Python package gensim.... window=10,... min_count=1,... batch_words=4... ))
Although the recipe for forward pass needs to be defined within
this function, one should call the Module instance afterwards
instead of this since the former takes care of running the
registered hooks while the latter silently ignores them.
This has any effect only on certain modules. See documentations of
particular modules for details of their behaviors in training/evaluation
mode, if they are affected, e.g. Dropout, BatchNorm,
etc.
Parameters:
mode (bool) – whether to set training mode (True) or evaluation
mode (False). Default: True.