A topic model is a probabilistic latent-variable model for discrete observations such as text documents. Latent Dirichlet allocation (LDA) represents each document as a finite mixture of topics, with each topic defined as a distribution over words. section 9.1 section 9.8
Under the bag-of-words assumption, word order and sentence structure are discarded. Each document becomes a vocabulary-count vector, and the corpus becomes a term-document matrix A. LDA can also be viewed as nonnegative matrix factorization, A = WH, where W contains shared topics and H contains document topic proportions. section 9.1
The LDA representation assigns:
- Each word occurrence xi,d a topic label zi,d drawn from K possible topics. section 9.1
- Each document d topic proportions θd, which can measure document similarity. section 9.1
- Each topic βk a distribution over the vocabulary shared across documents. section 9.1
- Hyperparameters α and η prior roles for document topic proportions and topic distributions. section 9.1
Document preprocessing
Represent a corpus of D documents with vocabulary counts, then optionally apply tf-idf weighting, A log(D/nt), to reduce the influence of terms appearing in many documents. The same matrix construction can use n-grams instead of unigrams. section 9.1 section 9.8
Figure 9.1 Latent Dirichlet allocation graphical model
Use the graphical model to inspect how document proportions, topic-word distributions, topic labels, words, and hyperparameters relate. section 9.1
