Data leakage happens when training data includes information about the prediction outcome that will not be available when predictions are made. It can produce impressive training and evaluation scores while failing on genuinely new cases. In link prediction, leakage is especially easy to introduce because graph features are computed from relationships that may also define the labels the classifier must predict. section 10.1 section 10.2
Feature leakage is a direct form of data leakage: a feature contains the same or very similar information as the output variable. Treat it as a model evaluation shortcut rather than useful predictive signal. If a classifier can recover the answer from a feature that would not exist at prediction time, its measured accuracy does not represent its ability to predict future or missing links. section 10.1 section 10.2.2
Shortest-path leakage
Suppose network distance is used to predict whether two nodes have a relationship. If that distance is calculated from the same relationships used as positive training and test examples, directly linked pairs have distance 1. The model can then learn that one-hop pairs always have a link, yielding perfect-looking training and test accuracy while performing poorly on missing or future links. section 10.1 section 10.2.2
The workflow separates relationships for feature generation, model training, and evaluation so graph-derived features cannot reveal the supervised link label. section 10.1
Prevent leakage in graph-based link prediction by separating the relationship data into distinct roles:
- Use one relationship set only to construct network features, such as distances or similarity measures. section 10.1 section 10.2
- Use a different relationship set as supervised samples for training the classification model. section 10.2
- Reserve another relationship set to evaluate the trained model. section 10.2
- Optionally add a validation set when performing hyperparameter optimization. section 10.2.2
This separation matters for many graph features, not only shortest-path distance. Features based on node closeness, similarity, or homophily-based node embeddings can leak label information when calculated from an improper split. Calculate features for both training and test samples strictly from the designated feature relationships; do not let either supervised set alter the graph used to derive those features. section 10.2 section 10.3
The split strategy depends on the prediction task. A random relationship split fits link completion when no time information is available. It randomly assigns relationships to feature, training, and evaluation roles while preserving the central rule: links used for feature calculation must differ from supervised links used to train and evaluate the classifier. section 10.2.2
Twitch shared-audience links
For a shared-audience network, a random query can mark a subset of Stream-to-Stream relationships as FEATURE_REL. Network features are then derived from those marked links, while separate relationship types hold positive and negative supervised samples. Keeping these roles apart supports recommendations for likely future audience overlap rather than merely rediscovering existing links. section 10.2.2 section 10.3
Leakage prevention also shapes feature choices. Manually defined link-prediction features can be evaluated first, while learned embeddings may require operational trade-offs. Transductive node embeddings used for link features can require retraining when a new node enters the graph; more complex inductive embeddings are a later option if needed. section 10.3








