gammagl.models.Node2vecModel¶
- class Node2vecModel(edge_index, edge_weight, embedding_dim, walk_length, p, q, num_walks=10, window_size=5, num_negatives=1, num_nodes=None, name=None)[source]¶
The Node2Vec model from the “node2vec: Scalable Feature Learning for Networks” paper where random walks of length
walk_lengthare sampled in a given graph, and node embeddings are learned via negative sampling optimization.- Parameters:
edge_index (Iterable) – The edge indices.
edge_weight (Iterable) – The edge weight.
embedding_dim (int) – The size of each embedding vector.
walk_length (int) – The walk length.
p (float) – Likelihood of immediately revisiting a node in the walk.
q (float) – Control parameter to interpolate between breadth-first strategy and depth-first strategy.
num_walks (int, optional) – The number of walks to sample for each node.
window_size (int, optional) – The actual context size which is considered for positive samples. This parameter increases the effective sampling rate by reusing samples across different source nodes.
num_negatives (int, optional) – The number of negative samples to use for each positive sample.
num_nodes (int, optional) – The number of nodes.
name (str, optional) – model name.