Description Usage Arguments Value Examples
Perform Latent Dirichlet Analysis or lda on a term-document matrix.
1 2 3 4 5 |
dtm |
An object of class |
topics, iter |
Number of topics and iterations. |
alpha |
Dirichlet dist. hyperparameter for topic distribution per document.
|
beta |
Dirichlet dist. hyperparameter for word distribution per topic.
|
A list containing.
ntopics_nwords
ntopics * nwords
Sparse matrix of probabilities s.t. sum(ntopics_nwords, 1) == 1.
ntopics_ndocs
ntopics * ndocs
Dense matrix of probabilities s.t. sum(theta, 1) == 1.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Not run:
init_textanalysis()
# build document
doc1 <- string_document("First document. Another sentence")
doc2 <- string_document("Some example written here.")
doc3 <- string_document("This is a string document")
doc4 <- string_document("Yet another document for the corpus.")
crps <- corpus(doc1, doc2, doc3, doc4)
update_lexicon(crps)
m <- document_term_matrix(crps)
lda <- lda(m, 2L, 1000L, .1, .1)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.