文脈
• word2vecで1単語について一度学習するために
入力として必要な周辺の単語数
• 補足:「文脈(Context)」と「窓(Window)」
• 窓は文脈の具体的な幅を指す
• 本解説では窓は不用だが、実際の実装では窓で考える
• 学習中に窓の幅をランダムに変えることで精度が上がる手法
[Goldberg 14]など、改善の余地がありそうな部分
2017/12/09 数学とコンピュータ Advent Calendar 2017 9
入力: “Jackdaws love my big sphinx of quartz”
窓1: my sphinx
窓2: love my sphinx of
学習対象を”big”とした窓の例
隠れ-出力間の重み更新
• 目的関数の最大化から出発
• 事後確率が最大となるような語彙のインデックスを𝑖∗とする
•以下損失関数𝐸の導出
max 𝑝 𝑤*∗ 𝑖𝑛𝑝𝑢𝑡 = max 𝑦*∗
= max log 𝑦*∗
= max 𝑢*∗ − log ] exp 𝑢6
Q
6RS
= max(−𝐸)
𝐸 ≔ −𝑢*∗ + log ] exp 𝑢6
Q
6RS
• この損失関数𝐸を最小化していく
• “Note that this loss function can be understood as a special case
of the cross-entropy measurement between two probabilistic
distributions.”
2017/12/09 数学とコンピュータ Advent Calendar 2017 15
参考文献 (登場順)
• 本スライド作成元
[Rong14] Rong, X.: Word2vec parameter learning
explained, arxiv preprint arXiv:1411.2738 (2014)
• 図式提供
自作
• その他文献
[Hinton 86] Hinton, G. E., McClelland, J. L., and Rumelhart,
D. E.: Distributed representations, in Parallel distributed
processing: Explorations in the microstructure of cognition,
Vol. 1, chapter 3, pp. 77–109, MIT Press Cambridge, MA,
USA (1986)
[Goldberg 14] Goldberg, Y. and Levy, O.: word2vec
explained: deriving mikolov et al. ’s negative sampling
word-embedding method, arXiv preprint arXiv:1402.3722
(2014)
[Mikolov 13a] Mikolov, T., Chen, K., Corradoa, G., and
Dean, J.: Efficient estimation of word representations in
vector space, International Conference on Learning
Representations (2013)
[Morin 05] Morin, F. and Bengio, Y.: Hierarchical
probabilistic neural network language model, In AISTATS,
Vol. 5, pp. 246–252, Citeseer. (2005)
[Mnih 09] Mnih, A. and Hinton, G. E.: A scalable
hierarchical distributed language model, In Koller, D.,
Schuurmans, D., Bengio, Y., and Bottou, L., editors,
Advances in Neural Information Processing Systems 21,
pp. 1081–1088, Curran Associates, Inc. (2009)
[Mikolov 13b] Mikolov, T., Sutskever, I., Chen, K., Corrado,
G., and Dean, J.: Distributed Representations of Words and
Phrases and their Compositionality, Advances in Neural
Information Processing Systems, pp. 3111–3119 (2013)
2017/12/09 数学とコンピュータ Advent Calendar 2017 56