Skip to contents

Row-normalised heatmap of old-to-transferred label pairs for accepted cells. High values on the diagonal indicate coherent transfer; strong off-diagonal entries warrant further inspection.

Usage

somalign_plot_label_confusion(fit, min_confidence = NULL)

Arguments

fit

A somalign_fit object.

min_confidence

Minimum transferred_label_confidence to include. NULL (default) imposes no additional filter beyond acceptance.

Value

A ggplot object.

Examples

set.seed(1)
mat <- rbind(
  matrix(rnorm(40, mean = -1), nrow = 20, ncol = 2),
  matrix(rnorm(40, mean =  1), nrow = 20, ncol = 2)
)
colnames(mat) <- c("F1", "F2")
labels <- rep(c("low", "high"), each = 20)
ref <- somalign_train_reference(mat, labels = labels,
                                grid = kohonen::somgrid(2, 2, "hexagonal"),
                                rlen = 5)
qry <- somalign_query(mat + 0.1, ref,
                      grid = kohonen::somgrid(2, 2, "hexagonal"),
                      rlen = 5)
fit <- somalign_fit(qry, ref)
#> somalign_fit: 1 query node(s) have match_mass_ratio > 1 (max 1.21); this is expected in unbalanced OT. See diagnostics$ot$match_mass_ratio for details.
somalign_plot_label_confusion(fit)