format_eta: Format 'eta' For Input into 'fit_lda_c'

View source: R/utils.R

format_etaR Documentation

Format eta For Input into fit_lda_c

Description

There are a bunch of ways users could format eta but the C++ Gibbs sampler in fit_lda_c only takes it one way. This function does the appropriate formatting. It also returns errors if the user input a malformatted eta.

Usage

format_eta(eta, k, Nv)

Arguments

eta

the prior for words over topics. Can be a numeric scalar, numeric vector, or numeric matrix.

k

the number of topics.

Nv

the total size of the vocabulary as inherited from ncol(dtm) in tidylda.

Value

Returns a list with two elements: eta and eta_class. eta is the post-formatted version of eta in the form of a k by Nv numeric matrix. eta_class is a character denoting whether or not the user-supplied eta was a "scalar", "vector", or "matrix".


tidylda documentation built on July 26, 2023, 5:34 p.m.