initializeBeta: Beta initialization

Description Usage Arguments Value Examples

View source: R/init_functions.R

Description

Used in the mmpca_clust() function to initialize beta. It can be either "random" or "lda". Please not that the mmpca_clust() function also allow for a user given beta matrix. In this case, this function is not used.

Usage

1
initializeBeta(dtm, init.beta, K, verbose = 0, control_lda_init = NULL)

Arguments

dtm

An object of class DocumentTermMatrix

init.beta

A string specifying the method, either

  • 'random': Initialization a la Blei et. al. with 1/V coefficient everywhere + a small uniform noise U[0, 1e-10] on every coefficients.

  • 'lda': Recommended. Uses the beta of LDA algorithm via a VEM algorithm, with an initialization of 5 repeats of the gibbs sampling algorithm with 1000 burning iterations and 1000 iterations.

K

The number of topics (dimension of the latent space).

verbose

The verbosity level. Only prints a message at function activation.

control_lda_init

The control for LDA(). Only used when init.beta == 'lda' and initilialized to the default "LDA_VEMcontrol" of the TopicModelcontrol class.

Value

A KxV matrix with each row summing to 1.

Examples

1
2
3
simu = simulate_BBC(N = 100, L = 100)
K = 4
beta = initializeBeta(simu$dtm.full, 'lda', K, verbose = 1)

MoMPCA documentation built on Jan. 21, 2021, 5:09 p.m.