Description Usage Arguments Value
Calculates perplexity for values of k on an LDA topic model using the topicmodels package, split into training and testing sets using k-folds
1 | fit.topics.perplexity(dtm, folds, k.values, alpha, beta, control.test)
|
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 |
k.values |
Numeric vector. Values to test k for. A good starting point is 2:10. All values must be greater than 1 |
alpha |
Numeric. Optional parameter: the value of alpha used in the LDA model. By default alpha is set to 0.1 |
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 |
Dataframe of perplexity for the k.values, calculated for the number of stipulated folds
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.