Vanilla (non-smoothed) LDA model trained using variational EM. Generates maximum-likelihood estimates for model paramters `alpha` and `beta`. Parameters ---------- T : int Number of topics Attributes ---------- D
(self, T=10)
| 4 | |
| 5 | class LDA(object): |
| 6 | def __init__(self, T=10): |
| 7 | """ |
| 8 | Vanilla (non-smoothed) LDA model trained using variational EM. |
| 9 | Generates maximum-likelihood estimates for model paramters |
| 10 | `alpha` and `beta`. |
| 11 | |
| 12 | Parameters |
| 13 | ---------- |
| 14 | T : int |
| 15 | Number of topics |
| 16 | |
| 17 | Attributes |
| 18 | ---------- |
| 19 | D : int |
| 20 | Number of documents |
| 21 | N : list of length `D` |
| 22 | Number of words in each document |
| 23 | V : int |
| 24 | Number of unique word tokens across all documents |
| 25 | phi : :py:class:`ndarray <numpy.ndarray>` of shape `(D, N[d], T)` |
| 26 | Variational approximation to word-topic distribution |
| 27 | gamma : :py:class:`ndarray <numpy.ndarray>` of shape `(D, T)` |
| 28 | Variational approximation to document-topic distribution |
| 29 | alpha : :py:class:`ndarray <numpy.ndarray>` of shape `(1, T)` |
| 30 | Parameter for the Dirichlet prior on the document-topic distribution |
| 31 | beta : :py:class:`ndarray <numpy.ndarray>` of shape `(V, T)` |
| 32 | Word-topic distribution |
| 33 | """ |
| 34 | self.T = T |
| 35 | |
| 36 | def _maximize_phi(self): |
| 37 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected