Skip to main content

Module negative_sampling

Module negative_sampling 

Source
Expand description

Negative edge sampling for link prediction training (ALGO-TR-007).

Generates random vertex pairs that do NOT have an edge in the graph, used as negative examples for training link prediction models (e.g., knowledge graph embeddings, GNN-based link predictors).

Functionsยง

sample_negative_edges
Sample non-edges (negative examples) uniformly at random.
sample_negative_edges_degree_biased
Sample negative edges proportional to vertex degree (popularity-biased).
sample_negative_edges_excluding
Sample negative edges avoiding a set of positive edges.