mergeTopics | R Documentation |
This operation is especially useful for the analysis of the model's output, by grouping together topics that share a common theme.
mergeTopics(x, merging_list)
x |
a |
merging_list |
a list where each element is an integer vector containing the indices of topics to be merged. If named, the list's names become the label of the aggregated themes. |
Topics are aggregated at the word assignment level. New document-topic and topic-word probabilities are derived from the aggregated assignments.
Note that the output of this function does not constitute an estimated
topic model, but merely an aggregation to ease the analysis. It is not
advised to use fit()
on the merged topic
model as it will radically affect the content and proportions of the new
themes.
A LDA()
or rJST()
model with the merged topics.
sentopics_labels
lda <- LDA(ECB_press_conferences_tokens, K = 5)
lda <- fit(lda, 100)
merging_list <- list(
c(1,5),
2:4
)
mergeTopics(lda, merging_list)
# also possible with a named list
merging_list2 <- list(
mytheme_1 = c(1,5),
mytheme_2 = 2:4
)
merged <- mergeTopics(lda, merging_list2)
sentopics_labels(merged)
# implemented for rJST
rjst <- rJST(ECB_press_conferences_tokens, lexicon = LoughranMcDonald)
rjst <- fit(rjst, 100)
mergeTopics(rjst, merging_list2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.