Description Usage Arguments Value Examples
View source: R/helper-functions.R
For more details, see Blei, D. M., & Lafferty, J. D. (2009). Topic models. In A. N. Srivastava & M. Sahami (Eds.), Text mining: Classification, clustering, and applications. Chapman and Hall/CRC.
1 |
beta_ |
A K x V matrix of V vocabulary probabilities for each of K topics. |
A K x V matrix of term-scores (comparable to tf-idf).
1 2 3 4 5 6 7 8 9 10 11 12 | #' library(lda) # Required if using `prep_docs()`
data(teacher_rate) # Synthetic student ratings of instructors
docs_vocab <- prep_docs(teacher_rate, "doc")
vocab_len <- length(docs_vocab$vocab)
m1 <- gibbs_sldax(rating ~ I(grade - 1), m = 2,
data = teacher_rate, docs = docs_vocab$documents,
V = vocab_len, K = 2, model = "sldax")
hbeta <- est_beta(m1)
ts_beta <- term_score(hbeta)
# One row per topic, one column per unique term in the vocabulary
str(ts_beta)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.