One Gibbs sampling sweep for LDA (collapsed) using document–term list.
Source:R/RcppExports.R
eLDA_pass_b_fast.RdThis function performs a single collapsed Gibbs sampling pass over all non-zero document–term entries. Each (d, v, count) triple is treated as `count` replicated word tokens sharing the same topic assignment.
Arguments
- mod
List with current sampler state:
z,nd,nw, andnwsumas described above.- count
IntegerMatrix of size NZ×3, where each row is a triple (d, v, c) with 0-based indices: document index
d, word indexv, and countcfor that (doc, word) pair.- ndsum
IntegerVector of length D; total token count per document (i.e.,
ndsum[d] = sum_k nd(d,k)). Updated in place.- NZ
Integer, number of non-zero entries (rows in
countand length ofz).- V
Integer, vocabulary size.
- K
Integer, number of topics.
- alpha
Scalar Dirichlet prior parameter for document–topic distributions \(\theta_d\) (symmetric).
- beta
Scalar Dirichlet prior parameter for topic–word distributions \(\phi_k\) (symmetric).