Name the elements (LDA models) and set the class (LDA_set) of the models returned by LDA_set.

package_LDA_set(mods, mod_topics, mod_seeds)

Arguments

mods

Fitted models returned from LDA.

mod_topics

Vector of integer values corresponding to the number of topics in each model.

mod_seeds

Vector of integer values corresponding to the seed used for each model.

Value

lis (class: LDA_set) of LDA models (class: LDA_VEM).

Examples

# \donttest{
  data(rodents)
  document_term_table <- rodents$document_term_table
  topics <- 2
  nseeds <- 2
  control <- LDA_set_control()
  mod_topics <- rep(topics, each = length(seq(2, nseeds * 2, 2)))
  iseed <- control$iseed
  mod_seeds <- rep(seq(iseed, iseed + (nseeds - 1)* 2, 2), length(topics))
  nmods <- length(mod_topics)
  mods <- vector("list", length = nmods)
  for (i in 1:nmods){
    LDA_msg(mod_topics[i], mod_seeds[i], control)
    control_i <- prep_LDA_control(seed = mod_seeds[i], control = control)
    mods[[i]] <- topicmodels::LDA(document_term_table, k = mod_topics[i],
                     control = control_i)
  }
  package_LDA_set(mods, mod_topics, mod_seeds)
# }