fit.alpha.perplexity: fit.alpha.perplexity

Description Usage Arguments Value

Description

Calculates perplexity for values of alpha on an LDA topic model using the topicmodels package, split into training and testing sets using k-folds

Usage

1
fit.alpha.perplexity(dtm, folds, alpha.values, k, beta, control.test)

Arguments

dtm

Document-term matrix. Constructed using the DocumentTermMatrix() command from the tm package

folds

Integer. The number of folds to make training and testing sets; recommended values are '5' and '10' - note that higher values considerably increase the time that model fitting takes

alpha.values

Numeric vector. Values to test alpha for. A good starting point is c(0.001, 0.01, 0.1, 1)

k

Integer. Optional parameter: the value of k used in the LDA model. By default k is set to 10

beta

Numeric. Optional parameter: the value of beta used in the LDA model. By default beta is set to 0.1

control.test

List. Optional parameter: the LDA control list used in the LDA model. It is strongly recommended not to use this parameter unless you have good reason. Default settings are: nstart = 5, best = T, burnin = 1000, iter = 2000, thin = 500

Value

Dataframe of perplexity for the alpha.values, calculated for the number of stipulated folds


bvidgen/RPackage documentation built on May 13, 2019, 9:04 a.m.