tidy.tidylda | R Documentation |
tidylda
topic modelTidy the result of a tidylda
topic model
## S3 method for class 'tidylda'
tidy(x, matrix, log = FALSE, ...)
## S3 method for class 'matrix'
tidy(x, matrix, log = FALSE, ...)
x |
an object of class |
matrix |
the matrix to tidy; one of |
log |
do you want to have the result on a log scale? Defaults to |
... |
other arguments passed to methods,currently not used |
Returns a tibble
.
If matrix = "beta"
then the result is a table of one row per topic
and token with the following columns: topic
, token
, beta
If matrix = "theta"
then the result is a table of one row per document
and topic with the following columns: document
, topic
, theta
If matrix = "lambda"
then the result is a table of one row per topic
and token with the following columns: topic
, token
, lambda
tidy(matrix)
: Tidy an individual matrix.
Useful for predictions and called from tidy.tidylda
If log = TRUE
then "log_" will be appended to the name of the third
column of the resulting table. e.g "beta
" becomes "log_beta
".
dtm <- nih_sample_dtm
lda <- tidylda(data = dtm, k = 10, iterations = 100, burnin = 75)
tidy_beta <- tidy(lda, matrix = "beta")
tidy_theta <- tidy(lda, matrix = "theta")
tidy_lambda <- tidy(lda, matrix = "lambda")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.