Learn R Programming

lda (version 1.1)

rtm.collapsed.gibbs.sampler: Collapsed Gibbs Sampling for the Relational Topic Model (RTM).

Description

Fit a generative topic model which accounts for both the words which occur in a collection of documents as well as the links between the documents.

Usage

rtm.collapsed.gibbs.sampler(documents, links, K, vocab, num.iterations, alpha, eta, beta)

Arguments

documents
A collection of documents in LDA format. See lda.collapsed.gibbs.sampler for details.
links
A list representing the connections between the documents. This list should be of the same length as the documents. Each element, links[[i]], is an integer vector expressing connections between document i and the
K
A scalar integer indicating the number of latent topics for the model.
vocab
A character vector specifying the vocabulary words associated with the word indices used in documents.
num.iterations
The number of sweeps of Gibbs sampling over the entire corpus to make.
alpha
The scalar value of the Dirichlet hyperparameter for topic proportions.
eta
The scalar value of the Dirichlet hyperparamater for topic multinomials.
beta
A length K numeric of regression coefficients expressing the relationship between each topic and the probability of link.

Value

Details

The Relational Topic Model uses LDA to model the content of documents but adds connections between documents as dependent on the similarity of the distribution of latent topic assignments. (See reference for details).

Only the exponential link probability function is implemented here. Note that the collapsed Gibbs sampler is different than the variational inference procedure proposed in the paper and is extremely experimental.

References

Chang, Jonathan and Blei, David M. Relational Topic Models for Document Networks. Artificial intelligence and statistics. 2009.

See Also

See lda.collapsed.gibbs.sampler for a description of the input formats and similar models.

nubbi.collapsed.gibbs.sampler is a different kind of model for document networks.

predictive.link.probability makes predictions based on the output of this model.

Examples

Run this code
## See demo.

demo(rtm)

Run the code above in your browser using DataLab