documentsums: Get word assignments from LDA_GIBBS class (output of...

Description Usage Arguments Value

Description

Get word assignments from LDA_GIBBS class (output of lda.fit). This is similar to the documentsums object that comes as the output of lda.collapsed.gibbs.sampler LDA assigns a topic to each unique word in a document. If you also want to take into account how often this word occured, the document term matrix (as used in the input for lda.fit) must be included in the weight.by.dtm argument.

Usage

1
documentsums(m, weight.by.dtm = NULL)

Arguments

m

The output from one of the topicmodeling functions in the topicmodels package (e.g., LDA_GIBBS)

weight.by.dtm

If you want to weight the topic assignment of a word to the number of times the word occured, give the document term matrix for this argument

Value

A matrix where rows are topics and columns are documents. Values represent the number of times the topic is assigned to a word in this document (essentially this is the same as the documentsums object in the output of lda.collapsed.gibbs.samler)


kasperwelbers/corpus-tools documentation built on May 20, 2019, 7:37 a.m.