View source: R/run_lda_models.R
run_lda_models | R Documentation |
This function fits a collection of lda models to a dataset, fitting one model
for each hyperparameter setting specified by the
lda_varying_params_list
argument. Its output can be directly used by
align_topics
.
run_lda_models(
data,
lda_varying_params_lists,
lda_fixed_params_list = list(),
dir = NULL,
reset = FALSE,
verbose = FALSE,
seed = 1L
)
data |
(required) a |
lda_varying_params_lists |
(required) a |
lda_fixed_params_list |
(optional) a |
dir |
(optional) a |
reset |
(optional, default = |
verbose |
(optional, default = |
seed |
(optional, default = |
a list of LDA models (see package topicmodels
).
? or a lda_models
object which would be a list of
1. a list of model;
2. some metadata about the alignement
set.seed(1)
data = matrix(sample(0:1000, size = 24), 4, 6)
lda_varying_params_lists = list(K2 = list(k = 2), K3 = list(k = 3))
lda_models =
run_lda_models(
data = data,
lda_varying_params_lists = lda_varying_params_lists,
dir = "test_lda_models/"
)
additional_lda_varying_params_list =
list(K4 = list(k = 4))
updated_lda_models =
run_lda_models(
data = data,
lda_varying_params_lists =
append(
lda_varying_params_lists,
additional_lda_varying_params_list),
dir = "test_lda_models/"
)
# because we specified the "dir" option, it only runs LDA for k = 4
unlink("test_lda_models/", recursive = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.