format_alpha: Format 'alpha' For Input into 'fit_lda_c'

Description Usage Arguments Value

View source: R/utils.R

Description

There are a bunch of ways users could format alpha 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 alpha.

Usage

1
format_alpha(alpha, k)

Arguments

alpha

the prior for topics over documents. Can be a numeric scalar or numeric vector.

k

the number of topics.

Value

Returns a list with two elements: alpha and alpha_class. alpha is the post-formatted version of alpha in the form of a k-length numeric vector. alpha_class is a character denoting whether or not the user-supplied alpha was a "scalar" or "vector".


tidylda documentation built on Dec. 11, 2021, 10:02 a.m.