Description Usage Arguments Value Examples
Function calls GetProbableTerms
with some
rules to get topic labels. This function is in "super-ultra-mega alpha"; use
at your own risk/discretion.
1 | LabelTopics(assignments, dtm, M = 2)
|
assignments |
A documents by topics matrix similar to |
dtm |
A document term matrix of class |
M |
The number of n-gram labels you want to return. Defaults to 2 |
Returns a matrix
whose rows correspond to topics and whose
j-th column corresponds to the j-th "best" label assignment.
1 2 3 4 5 6 7 8 9 10 | # Load a pre-formatted dtm and topic model
data(nih_sample_dtm)
data(nih_sample_topic_model)
assignments <- t(apply(nih_sample_topic_model$theta, 1, function(x){
x[ x < 0.05 ] <- 0
x / sum(x)
}))
labels <- LabelTopics(assignments = assignments, dtm = nih_sample_dtm, M = 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.