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

View source: R/utils.R

format_alphaR Documentation

Format alpha For Input into fit_lda_c

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

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 May 29, 2024, 11:03 a.m.