第15章自然言語処理:事前学習
15.1.1. One-Hot Vectors Are a Bad Choice15.1.1 ワンホットベクトルはよくない選択である
We used one-hot vectors to represent words (characters are words) in Section 9.5. Suppose that the number of different words in the dictionary (the dictionary size) is , and each word corresponds to a different integer (index) from to . To obtain the one-hot vector representation for any word with index , we create a length- vector with all 0s and set the element at position to 1. In this way, each word is represented as a vector of length , and it can be used directly by neural networks.
英語のヒント
9.5節では、単語(そこでは文字が単語である)を表すのにワンホットベクトルを使った。辞書にある異なる単語の数(辞書の大きさ)をとし、各単語がからまでの異なる整数(インデックス)に対応するとしよう。インデックスがの任意の単語のワンホットベクトル表現を得るには、すべて0の長さのベクトルを作り、位置の要素を1にする。こうして、各単語は長さのベクトルとして表され、ニューラルネットワークでそのまま使える。
Although one-hot word vectors are easy to construct, they are usually not a good choice. A main reason is that one-hot word vectors cannot accurately express the similarity between different words, such as the cosine similarity that we often use. For vectors , their cosine similarity is the cosine of the angle between them:
英語のヒント
ワンホットの単語ベクトルは作るのはたやすいが、ふつうはよい選択ではない。主な理由は、ワンホットの単語ベクトルでは、よく使うコサイン類似度のような、異なる単語の間の類似度を正確に表せないことである。ベクトルについて、それらのコサイン類似度は、それらのなす角のコサインである。
(15.1.1)
Since the cosine similarity between one-hot vectors of any two different words is 0, one-hot vectors cannot encode similarities among words.
英語のヒント
任意の異なる二つの単語のワンホットベクトルどうしのコサイン類似度は0なので、ワンホットベクトルは単語の間の類似度を符号化できない。