第15章自然言語処理:事前学習
15.5.1. Skip-Gram with Global Corpus Statistics15.5.1 コーパス全体の統計を使ったスキップグラム
Denoting by the conditional probability of word given word in the skip-gram model, we have
英語のヒント
スキップグラムモデルで、単語が与えられたときの単語の条件付き確率をで表すと、次のようになる。
(15.5.1)
where for any index vectors and represent word as the center word and context word, respectively, and is the index set of the vocabulary.
英語のヒント
ここで、任意のインデックスについて、ベクトルとは、それぞれ中心語と文脈語としての単語を表し、は語彙のインデックスの集合である。
Consider word that may occur multiple times in the corpus. In the entire corpus, all the context words wherever is taken as their center word form a multiset of word indices that allows for multiple instances of the same element. For any element, its number of instances is called its multiplicity. To illustrate with an example, suppose that word occurs twice in the corpus and indices of the context words that take as their center word in the two context windows are and . Thus, multiset , where multiplicities of elements are 2, 4, 1, 1, respectively.
英語のヒント
コーパスの中に何度も現れうる単語を考えよう。コーパス全体で、が中心語とされるすべての箇所の文脈語は、同じ要素が複数回現れることを許す単語のインデックスの多重集合をなす。どの要素についても、それが現れる回数をその重複度と呼ぶ。例で示すと、単語がコーパスに2回現れ、二つの文脈窓でを中心語とする文脈語のインデックスがとだとする。すると多重集合はであり、要素の重複度はそれぞれ2、4、1、1である。
Now let’s denote the multiplicity of element in multiset as . This is the global co-occurrence count of word (as the context word) and word (as the center word) in the same context window in the entire corpus. Using such global corpus statistics, the loss function of the skip-gram model is equivalent to
英語のヒント
ここで、多重集合での要素の重複度をで表そう。これは、コーパス全体を通じて、単語(文脈語として)と単語(中心語として)が同じ文脈窓の中で共起する回数である。そうしたコーパス全体の統計を使うと、スキップグラムモデルの損失関数は次と同値になる。
(15.5.2)
We further denote by the number of all the context words in the context windows where occurs as their center word, which is equivalent to . Letting be the conditional probability for generating context word given center word , (15.5.2) can be rewritten as
英語のヒント
さらに、が中心語として現れる文脈窓の中のすべての文脈語の数をで表す。これはと同じである。中心語が与えられたときに文脈語を生成する条件付き確率をとすると、(15.5.2)は次のように書き直せる。
(15.5.3)
In (15.5.3), calculates the cross-entropy of the conditional distribution of global corpus statistics and the conditional distribution of model predictions. This loss is also weighted by as explained above. Minimizing the loss function in (15.5.3) will allow the predicted conditional distribution to get close to the conditional distribution from the global corpus statistics.
英語のヒント
Though being commonly used for measuring the distance between probability distributions, the cross-entropy loss function may not be a good choice here. On the one hand, as we mentioned in Section 15.2, the cost of properly normalizing results in the sum over the entire vocabulary, which can be computationally expensive. On the other hand, a large number of rare events from a large corpus are often modeled by the cross-entropy loss to be assigned with too much weight.
英語のヒント
交差エントロピー損失関数は、確率分布の間の距離を測るのによく使われるが、ここではよい選択ではないかもしれない。一つには、15.2節で述べたように、をきちんと正規化するコストは語彙全体にわたる和になり、計算が高くつきうる。もう一つには、大きなコーパスの多数のまれな事象が、交差エントロピー損失によって、しばしば重すぎる重みを割り当てられるようにモデル化されてしまう。