
Wrapper function for the LDA parameters
params_lda.RdSolver options for the variational Bayes latent Dirichlet
allocation, see run_lda().
Usage
params_lda(
alpha = 50,
alpha_by_topic = TRUE,
eta = 0.1,
eta_by_topic = FALSE,
max_iter = 150L,
tol = 0.001,
inner_max_iter = 100L,
inner_tol = 0.001,
check_every = 10L,
learning = c("batch", "online"),
batch_size = 1024L,
n_epochs = 10L
)Arguments
- alpha
Numeric. Dirichlet prior on the document-topic distributions. Defaults to
50.0.- alpha_by_topic
Boolean. Shall
alphabe divided by the topic count. Defaults toTRUE.- eta
Numeric. Dirichlet prior on the topic-term distributions. Defaults to
0.1.- eta_by_topic
Boolean. Shall
etabe divided by the topic count. Defaults toFALSE.- max_iter
Integer. Maximum outer iterations. Ignored by the online variant, which counts epochs instead. Defaults to
150L.- tol
Numeric. Relative change in the bound below which the solver stops. Defaults to
0.001.- inner_max_iter
Integer. Maximum fixed-point iterations of the per-document E-step. Defaults to
100L.- inner_tol
Numeric. Relative L1 change in the variational parameters below which the per-document E-step stops. Defaults to
0.001.- check_every
Integer. Iterations between bound evaluations. Defaults to
10L.- learning
String. Batch or online variational inference. One of
c("batch", "online"). Defaults to"batch".- batch_size
Integer. Documents per mini-batch. Online only. Defaults to
1024L.- n_epochs
Integer. Passes over the corpus. Online only. Defaults to
10L.
Value
A named list with the following elements:
alpha - Numeric. Dirichlet prior on the document-topic distributions. Defaults to
50.0.alpha_by_topic - Boolean. Shall
alphabe divided by the topic count. Defaults toTRUE.eta - Numeric. Dirichlet prior on the topic-term distributions. Defaults to
0.1.eta_by_topic - Boolean. Shall
etabe divided by the topic count. Defaults toFALSE.max_iter - Integer. Maximum outer iterations. Ignored by the online variant, which counts epochs instead. Defaults to
150L.tol - Numeric. Relative change in the bound below which the solver stops. Defaults to
0.001.inner_max_iter - Integer. Maximum fixed-point iterations of the per-document E-step. Defaults to
100L.inner_tol - Numeric. Relative L1 change in the variational parameters below which the per-document E-step stops. Defaults to
0.001.check_every - Integer. Iterations between bound evaluations. Defaults to
10L.learning - String. Batch or online variational inference. One of
c("batch", "online"). Defaults to"batch".batch_size - Integer. Documents per mini-batch. Online only. Defaults to
1024L.n_epochs - Integer. Passes over the corpus. Online only. Defaults to
10L.
Details
The defaults follow pycisTopic, so the knobs mean the same thing on both
sides. alpha_by_topic = TRUE turns alpha into the Griffiths and
Steyvers 50 / k heuristic that cisTopic defaults to; set it to FALSE if
you want alpha taken literally.
learning = "batch" sweeps every document once per iteration and is
monotone in the bound. "online" takes decaying steps from shuffled
mini-batches, which reaches a usable fit in far fewer passes on a large
corpus at the cost of that guarantee. batch_size and n_epochs are only
read by the online variant.