View source: R/compute_number_of_paths.R
compute_number_of_paths | R Documentation |
This function computes the number of topics recursively in a backwards fashion. At the final level of the alignment, the path of each topic is the topic index. At intermediate levels, paths are built following the edges with the highest weights from children topics to parent topics.
compute_number_of_paths(aligned_topics, plot = FALSE)
aligned_topics |
(required) An |
plot |
(optional, default = FALSE) whether to visualize the number of paths. |
Given an alignment
object, this function computes the number of
paths at each level in the alignment. The result is a data.frame
mapping each level to a number from 1 to the number of current levels.
a data.frame
with the number of paths for each model. The
n_topics
column shows the total possible number of topics available
for that model while n_paths
gives the number of paths in that model.
align_topics
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)
compute_number_of_paths(alignment, plot = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.