Description Usage Arguments Value See Also Examples
Convenience function to extract
embeddings of the topic centers
embeddings of the words used in the model
words emmitted by each topic (beta), which is the softmax-transformed inner product of word embedding and topic embeddings
1 2 |
x |
an object of class |
type |
character string with the type of information to extract: either 'beta' (words emttied by each topic) or 'embedding' (embeddings of words or topic centers). Defaults to 'embedding'. |
which |
a character string with either 'words' or 'topics' to get either the embeddings of the words used in the model or the embedding of the topic centers. Defaults to 'topics'. Only used if type = 'embedding'. |
... |
not used |
a numeric matrix containing, depending on the value supplied in type
either the embeddings of the topic centers, the embeddings of the words or the words emitted by each topic
1 2 3 4 5 6 7 8 | library(torch)
library(topicmodels.etm)
path <- system.file(package = "topicmodels.etm", "example", "example_etm.ckpt")
model <- torch_load(path)
topic.centers <- as.matrix(model, type = "embedding", which = "topics")
word.embeddings <- as.matrix(model, type = "embedding", which = "words")
topic.terminology <- as.matrix(model, type = "beta")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.