A Java implemention of LDA(Latent Dirichlet Allocation)
A Java implemention of LDA(Latent Dirichlet Allocation)
A Java implemention of LDA(Latent Dirichlet Allocation). Inference topics from a set of documents with few lines of Java code.
public static void main(String[] args)
{
// 1. Load corpus from disk
Corpus corpus = Corpus.load("data/mini");
// 2. Create a LDA sampler
LdaGibbsSampler ldaGibbsSampler = new LdaGibbsSampler(corpus.getDocument(), corpus.getVocabularySize());
// 3. Train it
ldaGibbsSampler.gibbs(10);
// 4. The phi matrix is a LDA model, you can use LdaUtil to explain it.
double[][] phi = ldaGibbsSampler.getPhi();
Map[] topicMap = LdaUtil.translate(phi, corpus.getVocabulary(), 10);
LdaUtil.explain(topicMap);
}
…
No open issues yet, or sync has not completed.