LDA {topicmodels}R Documentation

Latent Dirichlet Allocation

Description

Estimate a LDA model using the VEM algorithm or Gibbs Sampling.

Usage

LDA(x, k, method = c("VEM", "Gibbs"), control = NULL,
    model = NULL, ...) 

Arguments

x Object of class "DocumentTermMatrix"
k Integer; number of topics
method The method to be used for fitting; currently method = "VEM" or method= "Gibbs" are supported.
control A named list of the control parameters for estimation or an object of class "LDAcontrol".
model Object of class "LDA" for initialization.
... Optional arguments. Currently not used.

Details

The C code for LDA from David M. Blei is used to estimate and fit a latent dirichlet allocation model with the VEM algorithm.

For Gibbs Sampling the C++ code from Xuan-Hieu Phan is used.

Value

LDA() returns an object of class "LDA".

Author(s)

Bettina Gruen

References

Blei D.M., Ng A.Y., Jordan M.I. (2003). Latent Dirichlet Allocation. Journal of Machine Learning Research, 3, 993-1022.

Phan X.H., Nguyen L.M., Horguchi S. (2008). Learning to Classify Short and Sparse Text & Web with Hidden Topics from Large-scale Data Collections. In "Proceedings of the 17th International World Wide Web Conference (WWW 2008)," pp.91-100. Beijing, China.

See Also

"LDAcontrol"

Examples

data("AssociatedPress", package = "topicmodels")
lda <- LDA(AssociatedPress[1:20,], control = list(alpha = 0.1), k = 2)
lda_inf <- LDA(AssociatedPress[21:30,], model = lda,
               control = list(em = list(iter.max = -1L)))

[Package topicmodels version 0.0-3 Index]