Skip to contents

One panel per metric, K on the x axis, one line per corpus (mean over runs, with the runs as points). The panel titles say whether higher or lower is better. Look for where held-out likelihood and residuals level off, where coherence starts to fall and diversity to drop, then read the coherence-exclusivity trade-off with plot_k_frontier().

Usage

plot_model_metrics(x, metrics = NULL, ncol = 3L, base_size = 16, ...)

Arguments

x

A topic_model_evaluation (evaluate_topic_models()), or a table with one row per model (e.g. stm::searchK()$results).

metrics

Character vector of metric columns to draw. Default: all available.

ncol

Number of panel columns.

base_size

Numeric scalar, base font size of the theme.

...

Not used: an argument renamed in the development version of mintR gives an error naming its replacement.

Value

A ggplot.

Examples

results <- data.frame(
  K = seq(10, 60, 10),
  heldout = c(-7.9, -7.8, -7.75, -7.74, -7.74, -7.75),
  residual = c(1.8, 1.5, 1.35, 1.3, 1.28, 1.27),
  coherence_umass = c(-60, -65, -72, -75, -82, -90),
  exclusivity = c(8.9, 9.3, 9.5, 9.45, 9.7, 9.75)
)
plot_model_metrics(results)