
Fit LDA across a range of topic counts and score each fit
rs_lda_k_sweep.Rd
Fits one model per requested topic count and evaluates each with the Arun,
Cao Juan and Mimno metrics. The corpus is built once and shared, and each
fit is already parallel over documents, so the topic counts run
sequentially rather than nesting Rayon pools.
Arguments
- sparse_data
A named list that needs to have
data,indptr,indices,nrow,ncolandcs_type. Documents x terms.- k_range
Integer vector. Topic counts to evaluate.
- lda_params
List. The LDA parameters, see
params_lda().- top_topics_coh
Optional integer. Number of top-scoring topics averaged into the reported coherence. If
NULL, defaults to5L.- seed
Integer. Seed for the variational initialisation.
- verbose
Integer.
0L- quiet;1L- normal verbosity;2L- detailed verbosity.
Value
A list with the following items
k - The topic counts that were tried.
models - One fitted model per topic count, see
rs_lda().metrics - One metric list per topic count, with
arun_2010,cao_juan_2009,mimno_2011,coherence_per_topic,boundandperplexity.combined_score - Rescaled combined score per entry.
NaNwhere the entry was excluded from selection by the coherence topic-count floor.best_k - Topic count with the highest combined score.