Skip to contents

Bootstrap-Based Stability Estimation for Label Propagation

Usage

label_spreading_bootstrap(
  adj,
  labels,
  refer = NULL,
  alpha = 0.8,
  sample_rate = 0.8,
  sample_n = 50,
  ...
)

Arguments

adj

A square adjacency matrix (preferably sparse) representing the graph.

labels

An integer vector of length equal to the number of nodes. Use `NA` for unlabeled entries.

refer

Optional. A reference soft label matrix (N x C). If not provided, computed from full label set.

alpha

Float in (0, 1). The propagation coefficient controlling the balance between prior and propagated labels (default: 0.9).

sample_rate

Fraction of labeled nodes used in each bootstrap sample (default: 0.8).

sample_n

Number of bootstrap replicates (default: 50).

...

Additional arguments passed to `label_spreading()`.

Value

A numeric vector of length N giving the deviance between each node's label probabilities and the reference across bootstraps.

Details

Repeatedly applies `label_spreading()` on subsampled label sets to assess the stability or uncertainty of label propagation results. Returns a node-level deviance score indicating variability across bootstrap runs.

Examples

if (FALSE) {
adj <- Matrix::rsparsematrix(100, 100, density = 0.05)
labels <- rep(NA, 100)
labels[1:10] <- sample(1:3, 10, replace = TRUE)
deviance_scores <- label_spreading_bootstrap(adj, labels)
}