plot() draws the measures of a topic-count comparison, or the fit report of
one of its candidates. With type = "metrics" (default) it draws three
panels against the number of topics: mean coherence, topic diversity, and the
share of the variance between topics, with a dotted line at the most coherent
candidate. A comparison of several segment levels draws one line per level,
told apart by color, point shape, and line type. The useful signal is usually
the count after which coherence stops improving, not the highest value.
type = "fit" draws the fit report of plot()
for the kept model with n_topics topics, one figure per segment level, so
that one number of topics can be read across segmentations.
Arguments
- x
A comparison returned by
compare_topics().- type
"metrics"(default) or"fit".- main
Overall title for
type = "metrics"(default"Topic-count comparison").- n_topics
For
type = "fit", the number of topics of the models to draw; required when the comparison holds several candidates. DefaultNULL.- segment
For
type = "fit", the segment levels to draw;NULL(default) for every level.- n_terms, n_representatives
For
type = "fit", terms and representatives per topic (defaults 8 and 5), passed to plot().- ...
Passed to the underlying plotting calls.
Conditions
An error of class sbert_bad_input when type = "fit" and n_topics
is missing for a comparison of several candidates.
Examples
corpus <- head(dedupe(feedback_translations, column = "translation"), 600)
comparison <- compare_topics(corpus, n_topics = c(4, 6, 8),
column = "translation",
embeddings = feedback_embeddings)
plot(comparison)
