hankcs / LDA4j

A Java implemention of LDA(Latent Dirichlet Allocation)

Home Page:http://www.hankcs.com/nlp/lda-java-introduction-and-implementation.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

有相关的api文档吗,如何获得新文档的主题分布?

haowuseu opened this issue · comments

有相关的api文档吗,请问如何获得新文档的主题分布?
int[] document = Corpus.loadDocument("data/mini/军事_510.txt", corpus.getVocabulary());
double[] tp = LdaGibbsSampler.inference(phi, document);
Map<String, Double> topic = LdaUtil.translate(tp, phi, corpus.getVocabulary(), 100);
LdaUtil.explain(topic);

这个功能还在探索中。

使用了吉布斯采样,应该有吉布斯更新规则,把新主题放进来更新一下就能得到结果。