View source: R/compute_strain_switching_score.R
compute_strain_switching_scores_of_model | R Documentation |
This function takes an alignment and a model identifier and returns
a data.frame
with the strain switching scores for each pair
of topics in that model.
compute_strain_switching_scores_of_model(alignment, model, n_ancestry_levels)
alignment |
(required) an |
model |
(required) a |
n_ancestry_levels |
(required) an |
The strain switching score for a given pair of topic (k1, k2) in model K
is currently computed as follow:
- the path of each topic is identified
- the models K1 and K2 at which each path first appears are identified
- the parent model K' is selected as the "latest" model between K1, K2
and Kmin, where Kmin is the model that is n_ancestry_level
ahead
of K
- for each topic k' in K', the strain switching score for the triplet
(k', k1, k2) is computed as r(k') w_in(k',k1) w_in(k', k2)
- the topic k' which maximizes that score for the pair (k1, k2) is returned
together with the score and K'.
A data.frame
providing the strain switching scores
for each pair of topic in the target model
.
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, method = "transport")
plot(alignment)
compute_strain_switching_scores_of_model(
alignment,
model = 5,
n_ancestry_levels = 2
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.