Compute Stability Metrics Across a Sequence of IkNN Graphs
Source:R/iknn_stability.R
compute.stability.metrics.RdComputes stability diagnostics across the pruned IkNN graphs produced by
create.iknn.graphs(). Metrics include edit distances between consecutive
graphs, graph-summary Jensen-Shannon divergence, edge-count diagnostics,
local minima, and smoothed trend fits for plotting.
Arguments
- graphs
An object of class
"iknn_graphs"returned bycreate.iknn.graphs().- graph.type
Character string, either
"geom"or"isize".- summary
Graph-summary family used for the divergence curve.
- divergence
Divergence used for consecutive-graph comparison. Currently only
"js".- labels
Optional vertex-label vector used when
summary = "neighborhood_label_distribution".- summary.args
Optional named list forwarded to
compute.graph.summary.stability().
Examples
set.seed(1)
x <- matrix(rnorm(60), ncol = 2)
graphs <- create.iknn.graphs(x, k.values = seq.int(2, 4), compute.full = TRUE,
verbose = FALSE)
stability <- compute.stability.metrics(graphs)
stability$edit.distances
#> [1] 26 19