第15章自然言語処理:事前学習
15.5.2. The GloVe Model15.5.2 GloVeモデル
In view of this, the GloVe model makes three changes to the skip-gram model based on squared loss (Pennington et al., 2014):
英語のヒント
このことを踏まえて、GloVeモデルは、二乗損失にもとづいて、スキップグラムモデルに三つの変更を加える(Pennington et al., 2014)。
- Use variables and that are not probability distributions and take the logarithm of both, so the squared loss term is .
英語のヒント
確率分布ではない変数とを使い、その両方の対数をとる。すると、二乗損失の項はになる。 - Add two scalar model parameters for each word : the center word bias and the context word bias .
英語のヒント
各単語について、スカラーのモデルパラメータを二つ、つまり中心語のバイアスと文脈語のバイアスを加える。 - Replace the weight of each loss term with the weight function , where is increasing in the interval of .
英語のヒント
各損失項の重みを重み関数に置き換える。ここで、は区間で増加する。
Putting all things together, training GloVe is to minimize the following loss function:
英語のヒント
すべてをまとめると、GloVeを訓練することは、次の損失関数を最小化することである。
(15.5.4)
For the weight function, a suggested choice is: (e.g ) if (e.g., ); otherwise . In this case, because , the squared loss term for any can be omitted for computational efficiency. For example, when using minibatch stochastic gradient descent for training, at each iteration we randomly sample a minibatch of non-zero to calculate gradients and update the model parameters. Note that these non-zero are precomputed global corpus statistics; thus, the model is called GloVe for Global Vectors.
英語のヒント
重み関数として提案されている選び方は、(たとえば)なら(たとえば)、そうでなければとするものである。この場合、なので、となるものの二乗損失の項は、計算の効率のために省いてよい。たとえば、訓練にミニバッチ確率的勾配降下法を使うときは、各反復で、0でないのミニバッチをランダムに抜き出して勾配を計算し、モデルのパラメータを更新する。これらの0でないは前もって計算したコーパス全体の統計であることに注意しよう。そのため、このモデルは大域ベクトル(Global Vectors)にちなんでGloVeと呼ばれる。
It should be emphasized that if word appears in the context window of word , then vice versa. Therefore, . Unlike word2vec that fits the asymmetric conditional probability , GloVe fits the symmetric . Therefore, the center word vector and the context word vector of any word are mathematically equivalent in the GloVe model. However in practice, owing to different initialization values, the same word may still get different values in these two vectors after training: GloVe sums them up as the output vector.
英語のヒント
単語が単語の文脈窓に現れるなら、その逆も成り立つことを強調しておくべきである。したがって、である。非対称な条件付き確率に当てはめるword2vecとは違って、GloVeは対称なに当てはめる。したがって、GloVeモデルでは、どの単語の中心語ベクトルと文脈語ベクトルも数学的に同値である。しかし実際には、初期値が異なるため、訓練の後でも同じ単語がこの二つのベクトルで異なる値をとることがある。GloVeは、それらを足し合わせたものを出力ベクトルとする。