topic_size: Calculate the size of each topic in a topic model

Description Usage Arguments Value References Examples

View source: R/topic_size.R

Description

Calculate the size of each topic in a topic model based on the number of fractional tokens found in each topic.

Usage

1
topic_size(topic_model)

Arguments

topic_model

a fitted topic model object from one of the following: tm-class

Value

A vector of topic sizes with length equal to the number of topics in the fitted model

References

Jordan Boyd-Graber, David Mimno, and David Newman, 2014. Care and Feeding of Topic Models: Problems, Diagnostics, and Improvements. CRC Handbooks ofModern Statistical Methods. CRC Press, Boca Raton, Florida.

Examples

1
2
3
4
5
# Using the example from the LDA function
library(topicmodels)
data("AssociatedPress", package = "topicmodels")
lda <- LDA(AssociatedPress[1:20,], control = list(alpha = 0.1), k = 2)
topic_size(lda)

topicdoc documentation built on Oct. 30, 2019, 11:26 a.m.