public class DistributedLDAModel extends LDAModel
Distributed LDA model.
This model stores the inferred topics, the full training dataset, and the topic distributions.
When computing topics for new documents, it may give more accurate answers
than the LocalLDAModel
.
Constructor and Description |
---|
DistributedLDAModel(LDA.EMOptimizer state,
double[] iterationTimes) |
Modifier and Type | Method and Description |
---|---|
scala.Tuple2<int[],double[]>[] |
describeTopics(int maxTermsPerTopic)
Return the topics described by weighted terms.
|
double[] |
iterationTimes() |
int |
k()
Number of topics
|
double |
logLikelihood()
Log likelihood of the observed tokens in the training set,
given the current parameter estimates:
log P(docs | topics, topic distributions for docs, alpha, eta)
|
double |
logPrior()
Log probability of the current parameter estimate:
log P(topics, topic distributions for docs | alpha, eta)
|
LocalLDAModel |
toLocal()
Convert model to a local model.
|
RDD<scala.Tuple2<Object,Vector>> |
topicDistributions()
For each document in the training set, return the distribution over topics for that document
("theta_doc").
|
Matrix |
topicsMatrix()
Inferred topics, where each topic is represented by a distribution over terms.
|
int |
vocabSize()
Vocabulary size (number of terms or terms in the vocabulary)
|
describeTopics
public DistributedLDAModel(LDA.EMOptimizer state, double[] iterationTimes)
public int k()
LDAModel
public int vocabSize()
LDAModel
public double[] iterationTimes()
public LocalLDAModel toLocal()
public Matrix topicsMatrix()
WARNING: This matrix is collected from an RDD. Beware memory usage when vocabSize, k are large.
topicsMatrix
in class LDAModel
public scala.Tuple2<int[],double[]>[] describeTopics(int maxTermsPerTopic)
LDAModel
This limits the number of terms per topic. This is approximate; it may not return exactly the top-weighted terms for each topic. To get a more precise set of top terms, increase maxTermsPerTopic.
describeTopics
in class LDAModel
maxTermsPerTopic
- Maximum number of terms to collect for each topic.public double logLikelihood()
Note:
- This excludes the prior; for that, use logPrior
.
- Even with logPrior
, this is NOT the same as the data log likelihood given the
hyperparameters.
public double logPrior()