簡體   English   中英

從gensim獲取主題的層次結構

[英]Get hierarchy of topic from gensim

gensim是否為我們提供了主題層次結構? 我寫了一段代碼來計算一些文檔的主題,輸出的是每個主題的單詞。 但是我想要主題的層次結構。 這是我的代碼:

https://gist.github.com/anonymous/2e3b2f3866e5029c55c3

這是輸出:

2014-06-16 13:02:22,540 : INFO : adding document #0 to Dictionary(0 unique tokens: [])
2014-06-16 13:02:38,162 : INFO : built Dictionary(324451 unique tokens: [u'considered,', u'\x00\x00', u'\ufb90\ufee0\ufbff\ufeea', u'\u0627\ufee7\ufed4\ufb91\ufe8e\u0643', u'\u0627\u0628\u0631\u0631\u0627\u06cc\u0627\u0646\u0647']...) from 885 documents (total 3885556 corpus positions)
2014-06-16 13:02:38,545 : INFO : storing corpus in Matrix Market format to corpus.mm
2014-06-16 13:02:38,546 : INFO : saving sparse matrix to corpus.mm
2014-06-16 13:02:38,554 : INFO : PROGRESS: saving document #0
2014-06-16 13:02:45,290 : INFO : saved 884x79405 matrix, density=0.514% (360672/70194020)
2014-06-16 13:02:45,292 : INFO : saving MmCorpus index to corpus.mm.index
2014-06-16 13:02:45,293 : INFO : loaded corpus index from corpus.mm.index
2014-06-16 13:02:45,293 : INFO : initializing corpus reader from corpus.mm
2014-06-16 13:02:45,293 : INFO : accepted corpus with 884 documents, 79405 features, 360672 non-zero entries
2014-06-16 13:03:06,913 : INFO : topic 0: 0.010*می + 0.006*دهند + 0.006*باره + 0.006*روی + 0.004*کسی + 0.004*بی + 0.004*مانند + 0.004*جز + 0.004*شود + 0.004*یکی + 0.004*چه + 0.004*اما + 0.004*دارد + 0.004*در + 0.004*بر + 0.004*آن + 0.004*او + 0.004*حتی + 0.004*که + 0.004*های
2014-06-16 13:03:07,097 : INFO : topic 1: 0.000*پست + 0.000*گرفت‌ + 0.000*Single + 0.000*ﺧﻨﻚ + 0.000*ﺑﻤﺎﻧﺪ + 0.000*حدودی + 0.000*352 + 0.000*«دين + 0.000*گروهي‌ + 0.000*ﺣﻔﺎ + 0.000*می​شود + 0.000*غنی + 0.000*   کشتي + 0.000*بستایم. + 0.000*19-20. + 0.000*67 + 0.000*تصرف + 0.000*مذاکرات» + 0.000*الات + 0.000*پسرش

有什么方法可以獲取主題的層次結構?

盡管名稱如此,但HDP不會為您提供主題層次結構。 為此,您需要分層的LDA( hLDA ), Gensim當前未實現。 該算法具有Blei Lab的C 實現和Mallet中的Java實現(mallet.cs.umass.edu/api/cc/mallet/topics/HierarchicalLDA.html)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM