align_topics | R Documentation |
This function takes a list of LDA models and returns an object of class
alignment
. Each element in the models list must be itself a named
list, corresponding to the mixed memberships ($gamma
) and topics
($beta
). The resulting alignment object can be plotted using 'plot'
and its weights can be extracted using the 'weights' accessor function. See
the documentation for class alignment
for further details.
align_topics(models, method = "product", ...)
models |
(required) A list of LDA models object. Each list component
must be a list with two named entries, $gamma (containing mixed memberships)
and $beta (containing topic parameters in log sapce). See
|
method |
(required) Either |
... |
(optional) Further keyword arguments passed to the weight
function. For example, passing |
After topics are aligned, they are re-ordered such that topics connected by high weights are ranked similarly within their respective models.
Topic paths (sets of topics connected by high weights across
models) are then identified and alignment diagnostics (topic refinement and
coherence scores) are computed. These variables are included to the
topics
container of the returned alignment
.
An object of class alignment
providing the weights between
every pair of topics of each model pairs in the input edgelist
(comparisons
).
alignment
library(purrr)
data <- rmultinom(10, 20, rep(0.1, 20))
lda_params <- setNames(map(1:5, ~ list(k = .)), 1:5)
lda_models <- run_lda_models(data, lda_params)
alignment <- align_topics(lda_models)
alignment
plot(alignment)
plot(alignment, color_by = "refinement")
alignment <- align_topics(lda_models, method = "transport")
plot(alignment)
plot_beta(alignment)
topics(alignment)
weights(alignment)
models(alignment)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.