compute_number_of_paths: Computes the number of paths

View source: R/compute_number_of_paths.R

compute_number_of_pathsR Documentation

Computes the number of paths

Description

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.

Usage

compute_number_of_paths(aligned_topics, plot = FALSE)

Arguments

aligned_topics

(required) An alignment class with the alignment results.

plot

(optional, default = FALSE) whether to visualize the number of paths.

Details

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.

Value

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.

See Also

align_topics

Examples

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)


lasy/alto documentation built on June 23, 2024, 6:45 a.m.