mallet.subset.topic.words: Estimate topic-word distributions from a sub-corpus

Description Usage Arguments See Also Examples

View source: R/mallet.R

Description

This function returns a matrix of word probabilities for each topic similar to mallet.topic.words, but estimated from a subset of the documents in the corpus. The model assumes that topics are the same no matter where they are used, but we know this is often not the case. This function lets us test whether some words are used more or less than we expect in a particular set of documents.

Usage

1
mallet.subset.topic.words(topic.model, subset.docs, normalized=FALSE, smoothed=FALSE)

Arguments

topic.model

The model returned by MalletLDA

subset.docs

An array of TRUE/FALSE values specifying which documents should be used and which should be ignored.

normalized

If true, normalize the rows so that each topic sums to one. If false, values will be integers (possibly plus the smoothing constant) representing the actual number of words of each type in the topics.

smoothed

If true, add the smoothing parameter for the model (initial value specified as beta in MalletLDA). If false, many values will be zero.

See Also

mallet.topic.words

Examples

1
2
3
4
5
## Not run: 
nips.topic.words <- mallet.subset.topic.words(topic.model, documents$class == "NIPS",
		    				smoothed=T, normalized=T)

## End(Not run)

mallet documentation built on May 2, 2019, 8:31 a.m.