perplexity | R Documentation |
perplexity()
computes the perplexity score to help users to chose the
optimal values of hyper-parameters for LDA.
perplexity(x, newdata = NULL, ...)
x |
a LDA model fitted by |
newdata |
if provided, |
... |
additional arguments passed to textmodel_lda. |
perplexity()
predicts the distribution of words in the dfm based
on x$alpha
and x$gamma
and then compute the sum of disparity between their
predicted and observed frequencies. The perplexity score minimizes when the
chosen values of hyper-parameters such as k
, alpha
and gamma
are
optimal.
Returns a singple numeric value.
divergence
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.