From Neighborhood Evidence to a Risk Score
Before you start: The construction chapter defines our four applications, typed edges, and historical snapshots.
A’s graph is useful only if it improves a decision about A. There are three distinct computations to consider: summarize its neighbors once, repeatedly spread a signal, or learn how to combine node features. We will keep them separate so a neighborhood average does not quietly become a claimed probability of risk.
Start with one weighted neighborhood
Use the 10 August connection weights: A–B has weight 2, while A–C and A–D each have weight 0.5. Suppose an intrinsic classifier, using only each app’s own features, supplied the following saved scores:
| App | Saved score | Weight into A | Weighted contribution |
|---|---|---|---|
| A | 0.20 | Excluded from its own neighbors | — |
| B | 0.90 | 2 | 1.80 |
| C | 0.60 | 0.5 | 0.30 |
| D | 0.10 | 0.5 | 0.05 |
Add the contributions: 1.80 + 0.30 + 0.05 = 2.15. Divide by total weight 3 to get a neighborhood mean of about 0.7167. B dominates because its connection carries four times either domain connection’s weight. This number describes A’s neighbors under a chosen rule; it has not been calibrated against A’s outcomes.
One neighbor can produce an extreme mean with little evidence. To smooth it, add a prior mean of 0.20 with strength 2. Think of two extra units of weight, each carrying value 0.20. The new numerator is 2.15 + 0.40; the denominator is 3 + 2. The result is 0.51.
(2.15 + 0.40) / (3 + 2) = 0.5100
Now name the pieces. $N(a)$ is the set of contributing neighbors, $w_{ab}$ their nonnegative weights, and $s_b$ their saved scores. The prior mean is $\mu$, its strength is $\lambda$, and $z_a$ is the resulting feature:
Prior strength uses the same units as edge weight. Multiplying every edge weight by ten while leaving $\lambda$ unchanged makes the prior relatively weaker. With no neighbors and positive strength, the result is $\mu$. With neither neighbors nor prior weight, the mean is undefined. Preserve an evidence count so the downstream model can distinguish “prior only” from several observations agreeing with the prior.
Choose the prior from training data or a declared operational assumption, then validate its strength. When inputs are model scores, this is weighted smoothing; it does not turn those scores into independent observations or calibrated probabilities. Ten copied reports or ten apps from one incident should not automatically count like ten unrelated sources.
Add graph features to a supervised model
Keep A’s own feature row and append the graph features: smoothed neighbor score, total weight, label coverage by relation, and evidence age. Fit a classifier to the target outcome using this combined row. It can learn that a strong neighborhood signal matters differently for a new application than for a long-observed one.
Compare the intrinsic-only model and the combined model on the same held-out decisions. The first tests what each application reveals about itself; the second tests the additional value of relationships. Calibration and operating-threshold checks belong to the resulting classifier, not to the neighbor average.
How can a target’s label leak back through a neighbor?
Imagine seeding A’s training label into propagation. It travels A → B on the first round and B → A on the next. Removing a direct self-edge does not remove this path. Any label-derived feature for A must be computed with A’s target label hidden throughout the computation.
Saved model predictions need the same care. At an outer validation boundary, exclude all validation labels from every fitted stage. Within training data, use suitable inner folds or forward-only fits to create score features. Merely hiding B’s label when predicting B is insufficient if the model still sees A’s label and B’s prediction later becomes A’s input. Match the label visibility and time rules of the final deployment.
Repeating the update lets evidence return
One-hop aggregation reads the saved neighbor scores once. Propagation uses the newly computed scores as inputs to another round. To see the difference, temporarily keep only the publisher connection A–B, with starting scores 0.20 and 0.90. Each app then has exactly one neighbor.
Mix a fraction $\alpha$ of the neighbor’s previous score with a fraction $1-\alpha$ of the app’s original score. The original score is reintroduced on every round; this is called a restart. At $\alpha=0.5$, A’s first update is $0.5\times0.90+0.5\times0.20=0.55$.
At $\alpha=1$, A and B simply exchange their scores forever. At 0.5, the first round gives both 0.55, but the second separates them again: A becomes 0.375 and B becomes 0.725 because their restart values differ. Later rounds settle toward about 0.4333 and 0.6667. Convergence says the computation settles; it does not establish predictive accuracy.
The general update and why restart helps it settle
Let $\mathbf{s}^{(k)}$ contain every node’s score at round $k$, and let $\mathbf{y}$ contain the fixed starting scores. A row of $P$ contains that node’s neighbor weights divided by their total, so multiplying by $P$ takes a weighted neighbor average. Give an isolated node a self-loop for this definition. Every row then sums to one.
A weighted average cannot make the largest absolute difference between two score vectors larger. Multiplying by $\alpha<1$ shrinks that difference each round, giving a unique fixed point. For our pair, solve A = αB + (1 − α)0.20 and B = αA + (1 − α)0.90. The limits are A = (0.20 + 0.90α)/(1 + α) and B = (0.90 + 0.20α)/(1 + α). At α = 1 the iteration need not converge, as the figure shows.
Zhou et al. use a related restart iteration with a symmetrically normalized graph matrix. Our row-normalized version makes each update a neighbor average; the normalization choice is part of the algorithm.
Restart and clamping are different. A clamped label-propagation method restores trusted seed labels after each round. Our figure restarts toward saved model scores and lets both scores move. scikit-learn’s discussion distinguishes hard and soft label constraints. Use the variant that matches what your initial signal means.
Repeated propagation expands the paths through which a signal can influence A. It can also send the same information around a loop, spread through a weak shared host, and make distinct neighborhoods look similar. Treat relation choice, restart strength, and number of rounds as validation choices. More rounds do not create more independent evidence.
A GNN learns a representation from the neighborhood
A graph neural network can combine each node’s feature vector with an aggregate of its neighbors’ vectors. In a simple mean-aggregation layer, averaging is fixed and the transformation after combining the vectors is learned. GraphSAGE learns shared aggregation/combination functions that can be applied to unseen nodes with usable features and neighborhoods.
Output: a new vector for A. A prediction head converts the final vector into the task’s score.
A neighbor score average compresses evidence into a scalar you chose. A learned vector can retain different signals for different prediction tasks. That flexibility adds fitting, neighbor sampling, and serving work. Keep publisher and domain evidence distinguishable; a model cannot recover a relation type that preprocessing discarded.
Begin with intrinsic features plus simple graph features. Move to a GNN when a matched evaluation shows that learning the neighborhood representation adds value, or when the task needs a capability the simpler model lacks. “Works on unseen nodes” describes how the model can be applied; performance on new publishers still needs measurement.
Keep the feature, prediction, and evidence distinct
| Question | Record to inspect |
|---|---|
| Why is the smoothed feature 0.51? | B/C/D’s saved scores and weights, prior mean 0.20, strength 2. |
| Why did the classifier increase A’s score? | The fitted model’s response to A’s intrinsic and graph features. |
| Is that graph evidence trustworthy? | Source observations, relation types, label/model provenance, and availability at A’s decision time. |
An attribution to “neighbor risk” answers only part of the question. Preserve the evidence that produced the feature, including whether a contributing number came from a trusted label, a saved prediction, or a previous propagation round. Then test the final decision rule at a realistic time cutoff and review budget.
References and further reading
- Hamilton, Ying & Leskovec: GraphSAGE — Shared neighborhood aggregation for inductive node representations; Algorithm 1 gives the layer computation.
- Zhou et al.: Learning with Local and Global Consistency — A restart-style label-spreading iteration. Its symmetric normalization differs from the row averages used in our example.
- scikit-learn: label propagation — The distinction between hard label clamping and softer label constraints.