1
我有LDA模型和文檔主題概率。在gensim中提取主題詞概率矩陣LdaModel
# build the model on the corpus
ldam = LdaModel(corpus=corpus, num_topics=20, id2word=dictionary)
# get the document-topic probabilities
theta, _ = ldam.inference(corpus)
我還需要爲所有主題分配單詞,即主題詞概率矩陣。有沒有辦法提取這些信息?
謝謝!
'ldam.state.get_lambda() '我得到了一個numpy矩陣,但沒有列名。我如何識別單詞? –
要知道哪個單詞對應給定的索引,請使用'ldam.id2word'。例如'ldam.id2word [0]'是對應於矩陣第一列的單詞。 – arthur