advanced24 min studyLesson 830 in Engineering

Match graph evaluation splits to the claimed generalization

Separate transductive visibility, unseen-node encoding and temporal prediction protocols.

On this page

What you’ll understand

  • State which nodes, edges, features and labels are visible in each evaluation regime.
  • Compute average precision under a fixed candidate protocol.
  • Avoid treating connected evaluation nodes as automatically independent samples.

A graph model can succeed at predicting hidden labels on known nodes while failing on unseen entities or future interactions. These are different generalization questions. A credible evaluation names the training information boundary and the test-time resources explicitly: whether test nodes were in the training graph, whether their features were visible, which edges are allowed and how prediction candidates are chosen. A split name alone does not define those conditions.

Transductive and inductive refer to permitted information

In a transductive node-classification protocol, unlabeled test-node features and graph structure can be available during training while test labels remain hidden. That is legitimate when declared, but it does not establish generalization to entirely unseen nodes. In a strict node-inductive protocol, held-out test nodes are excluded from the training computation graph, including neighborhood sampling and fitted feature statistics. At inference, their available features and permitted neighborhoods can be used according to the deployment scenario. Inductive capability still depends on meaningful features and distributional coverage.

GraphSAGE learns feature-and-neighborhood aggregation rather than requiring a trained vector for every node ID, enabling its studied unseen-node setting. A model can lose that practical capability if its pipeline adds a required learned ID table without an unseen-node policy. Entirely unseen graphs pose an additional shift in topology, features and label distribution. Split by entity, source graph or time when that matches deployment, and prevent related duplicates or inverse edge records from crossing boundaries in a way that reveals target information.

Vseen in training∩Vtest=∅V_{\rm seen\ in\ training}\cap V_{\rm test}=\varnothing
This is a strict node-inductive visibility condition, where “seen” includes context nodes used in training computation, not only labeled seeds. It is not required for a declared transductive protocol and does not by itself guarantee distributional generalization.↔ Scroll wide equations horizontally.

Temporal splits need feature and candidate rules too

A chronological edge split does not prevent leakage if neighborhood features or degrees were computed from the final graph. Enforce event and availability cutoffs for every derived input, and specify whether earlier validation or test events update state after being scored. Hold the candidate set and negative sampling protocol fixed when comparing models. Easy random nonedges and historically plausible candidates can yield different ranking difficulty, so their metrics are not interchangeable estimates of one unnamed task.

Average precision rewards positive items near the top of a ranked candidate list, averaging precision at each positive’s rank. Candidate composition matters because high-scoring negatives push those ranks downward. State the number and distribution of candidates, tie handling and whether metrics are computed per source then averaged or pooled globally. Precision at a random draw equals candidate prevalence, but that observation is not an exact finite-sample formula for expected average precision. Avoid using a balanced sampled classification metric as a deployment retrieval guarantee.

AP⁡=1P∑j=1Myj∑i=1jyij,P=∑j=1Myj>0\operatorname{AP}=\frac1P\sum_{j=1}^{M}y_j\frac{\sum_{i=1}^{j}y_i}{j},\qquad P=\sum_{j=1}^{M}y_j>0
Candidates are sorted from highest to lowest score under a declared tie rule; y_j is a binary positive label. AP is dimensionless. The formula requires at least one positive; zero-positive queries need an explicitly chosen evaluation convention.↔ Scroll wide equations horizontally.

Report variation at a defensible sampling unit

Nodes in the same connected region can share features, neighbors and labels, so treating all test nodes as independent can understate uncertainty. Use a design aligned with the intended generalization unit, such as held-out graphs, entities or temporal blocks, and report critical slices by degree, node type and novelty. Repeat stochastic training and sampling under a declared seed design. Training-seed variability is different from uncertainty about future deployment graphs, and neither is eliminated by a large count of highly related test edges.

For an independent-sample comparison, Reset the sampling lab and set both p=0.2 and n=25. Predict variance 0.0064 and standard deviation 0.08 for the sample mean. Separately Reset and set both p=0.2 and n=100; predict variance 0.0016 and standard deviation 0.04. Play highlights exact binomial outcomes. This iid Bernoulli instrument illustrates a sample-size law only; it does not compute AP, capture graph dependence or justify counting connected evaluation nodes as independent.

Different negatives can change AP without changing positive scores

A query has two positive candidates with fixed scores. Under one negative set, the ranked labels are [1,0,1,0]. Replace those negatives with higher-scoring candidates so the ranked labels become [0,1,0,1], leaving the two positive scores unchanged. Compute AP in both cases under these strict rankings.

  1. For the first list, positives occur at ranks 1 and 3. Their precisions are 1/1=1 and 2/3. Average precision is (1+2/3)/2=5/6≈0.8333.

  2. For the harder negative list, positives occur at ranks 2 and 4. Precisions are 1/2 and 2/4, so average precision is (0.5+0.5)/2=0.5. The candidate change lowers AP by 1/3 in absolute AP units.

  3. The difference is 5/6−1/2=1/3, about 33.33 percentage points of AP. Since the positive scores stayed fixed, attributing that whole difference to model quality would be misleading; the negative candidate protocol changed the ranking task.

The result

AP comparisons need the same documented candidate construction. These tiny lists isolate a protocol effect rather than estimating a real graph model’s performance or uncertainty.

Explore the model

Interactive lab

Interactive lab · sampling

Independent counts have an explicit uncertainty assumption

Reset → set p=0.2 and n=25 → predict variance 0.0064 and SD 0.08. Separate Reset → set p=0.2 and n=100 → predict variance 0.0016 and SD 0.04.

Independent counts have an explicit uncertainty assumptionExact binomial masses for the mean of n independent Bernoulli trials, compared with normal mass between adjacent half-count boundaries; normal tails outside the finite support remain outside the bars. Playback highlights outcomes, not random samples. The Berry–Esseen bound applies to standardized CDFs, not individual bars or continuity-corrected errors. At p = 0 or 1, normal comparison and that bound are disabled. Normal-CDF evaluation uses a numerical approximation with absolute error below 7.5×10⁻⁸ (at most 1.5×10⁻⁷ per interval, before rounding). Current readings: Mean sample proportion: 0.5; Sample-mean variance: 0.0125; Uniform CDF error bound: ≤ 0.1062. All parameters are adjustable with the labeled controls below.Exact distribution of the mean of 20 independent Bernoulli variables with success probability 0.5; playback highlights outcome 0.00.250.50.75100.0580.1150.1730.23Sample mean · k / nProbability massNormal bin masses are an approximationk = 0 · exact probability = 9.54e-7
Exact binomial massNormal interval massHighlighted outcome / mean
Mean sample proportion
0.5
Sample-mean variance
0.0125
Uniform CDF error bound
≤ 0.1062
t = 0 s

Exact binomial masses for the mean of n independent Bernoulli trials, compared with normal mass between adjacent half-count boundaries; normal tails outside the finite support remain outside the bars. Playback highlights outcomes, not random samples. The Berry–Esseen bound applies to standardized CDFs, not individual bars or continuity-corrected errors. At p = 0 or 1, normal comparison and that bound are disabled. Normal-CDF evaluation uses a numerical approximation with absolute error below 7.5×10⁻⁸ (at most 1.5×10⁻⁷ per interval, before rounding). Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forThe exact binomial sample-mean model has independent binary trials. It does not represent AP, connected-node dependence or graph-level generalization.

Check your understanding

A model used unlabeled test nodes as training-time message context. Which claim does that alone rule out?

Try it yourself

A ranked list has three positives at ranks 1,3 and 5, with no score ties. Compute AP. If twenty additional negatives are appended below every existing candidate, does this query’s AP change? Does that make candidate protocols irrelevant in general?

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Average precision uses precision at positive ranks. Appending lower-ranked negatives leaves those particular ranks unchanged.

Compare with the solution

AP=(1+2/3+3/5)/3=34/45≈0.7556. Adding only lower-ranked negatives leaves those positive ranks and this AP unchanged. Candidate protocols still matter because higher-scoring or differently distributed negatives can move positive ranks, as the worked example shows; one harmless append does not establish protocol invariance.

Take it with you

  • Split visibility must include context nodes and derived features, not only labels.
  • Inductive, transductive and temporal protocols answer different questions.
  • Candidate construction and graph dependence belong in the evaluation report.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.