Figure 4: The graphical model for latent Dirichlet allocation. Each node is a random variable and is labeled according to its role in the generative process (see Figure 1). The hidden nodes–the topic proportions, assignments and topics—are unshaded. The observed nodes—the words of the documents—are shaded. The rectangles are “plate” notation, which denotes replication. The N plate denotes the collection words within documents; the D plate denotes the collection of documents within the collection.
a graphical language for describing families of probability distributions.5 The graphical model for LDA is in Figure 4. These three representations are equivalent ways of describing the probabilistic assumptions behind LDA.
In the next section, we describe the inference algorithms for LDA. However, we first pause to describe the short history of these ideas. LDA was developed to fix an issue with a previously developed probabilistic model probabilistic latent semantic analysis (pLSI) [21]. That model was itself a probabilistic version of the seminal work on latent semantic analysis [14], which revealed the utility of the singular value decomposition of the document-term matrix. From this matrix factorization perspective, LDA can also be seen as a type of principal component analysis for discrete data [11, 12].
2.2 Posterior computation for LDA
We now turn to the computational problem, computing the conditional distribution of the topic structure given the observed documents. (As we mentioned above, this is called the posterior.) Using our notation, the posterior is
p( 1:K, ✓1:D, z1:D| w1:D) = p( 1:K, ✓1:D, z1:D, w1:D)
p(w1:D) . (2) The numerator is the joint distribution of all the random variables, which can be easily computed for any setting of the hidden variables. The denominator is the marginal probability of the observations, which is the probability of seeing the observed corpus under any topic model. In theory, it can be computed by summing the joint distribution over every possible instantiation of the hidden topic structure.
5The field of graphical models is actually more than a language for describing families of distributions. It is a field that illuminates the deep mathematical links between probabilistic independence, graph theory, and algorithms for computing with probability distributions [35].
7
圖 3.2: LDA 模型圖形表示法(plate notation)
接著我們要進行的部分是 LDA 的計算問題,即在我們擁有(欲觀察的)文章 多關鍵字分類,許多社群網路平台(如 Twitter 、 Facebook )也有提供 hashtag 的 標記功能,我們假設這些分類的關鍵字及 hashtag 標記能夠代表該文章的主題,則 這些資訊應該納入 LDA 主題分布的考量之中,故某些學者提出監督式的 LDA , 使傳統 LDA 演算法能夠在推論主題模型時將該資訊納入其中。
依照 Ramage 等人所提出的標記式隱含迪利克雷分布(Labeled LDA),我 們將可以簡單地用預先觀察到的文章主題(即人工標記的主題分類)去限制主
‧
Algorithm 1 Labeled LDA之生成過程
1: for all topick∈ {1, ..., K}: do
2: Generateβk= (βk,1, ..., βk,V)T ∼Dir(· | η)
3: end for
4: for all documentd: do
5: for all topick ∈ {1, ..., K}: do
0 otherwise. (3.3) 換句話說,當此矩陣 L(d) 的第 i 行中的第 j 列的元素為 1 時,即表示第 i 篇文章 一以及主題三之中。再透過 Gibbs Sampling [7],我們便能夠訓練出文章內每個字 詞所對應的主題機率。
‧
‧
(Directed acyclic graph, DAG)表示,最後再計算出最佳的切分方式,得到初步 的斷詞結果。
‧
‧ 國
立 政 治 大 學
‧
N a tio na
l C h engchi U ni ve rs it y
研究所使用之文本《自由中國》為例:在主題「外交/聯合國問題」之中,「聯 合國」、「康隆報告」以及「共同防禦條約」等字詞為文本擁有者所認定,與該 主題十分相關的詞彙,我們希望藉由先前提及的權重概念,將種子字詞納入考 量,間接影響其他與該字詞共同出現的詞彙,提昇演算法所群聚出的詞彙質量。
同樣的,在斷詞處理中我們也將這些種子字詞加入至自定義詞典中,以確保斷詞 的正確性。
有了這些種子字詞之後,我們便能依循上述長字詞優先的權重調整方法,將 權重向量 W 重新定義為:
wi =
(1 ifwi is seed word
wi otherwise. (3.8) 在上述判斷式中,權重向量 W 已經先經過長字詞的權重調整,並且已經將各個元 素標準化至總和為 1 ,故我們可以確定所有的 wi 的值皆小於 1 ,如此一來經由 第二度的權重調整,可以更加地將提高種子字詞的權重,並同時考量了其他長字 詞的權重。最後,我們同樣依照公式(3.7)來得到新的 ˆη ,並且在乘上 η 之前,先 將 W 內的元素再標準化一次。
如上所述,種子字詞是依照使用者(文本史料擁有者)所認定能夠真實表示 主題意義的詞彙,因此,在種子字詞的提取方面亦是採取人工標記的方式,由使 用者在事前標記好各個主題所可能隱含的種子字詞,並由以上的權重向量公式將 其納入演算法之中。
本研究所使用之種子字詞是由薛化元教授團隊所提供,由團隊史學家以其經 驗統整出該主題所應包含的詞彙。此外,我們所提出的方法亦能夠找到更多的種 子字詞,隨著實驗的進行,將能產生出強化過後的主題群聚結果,團隊史學家們 可以根據所產生的主題詞彙新增或刪減種子字詞,而後再將後標記的新種子字詞 加入演算法之中,如此便能循序漸進地改善效能。