1. 程式人生 > >Word Embedding的通俗解釋

Word Embedding的通俗解釋

word embedding的意思是:給出一個文件,文件就是一個單詞序列比如 “A B A C B F G”, 希望對文件中每個不同的單詞都得到一個對應的向量(往往是低維向量)表示。
比如,對於這樣的“A B A C B F G”的一個序列,也許我們最後能得到:A對應的向量為[0.1 0.6 -0.5],B對應的向量為[-0.2 0.9 0.7] (此處的數值只用於示意)

之所以希望把每個單詞變成一個向量,目的還是為了方便計算,比如“求單詞A的同義詞”,就可以通過“求與單詞A在cos距離下最相似的向量”來做到。

word embedding不是一個新的topic,很早就已經有人做了,比如bengio的paper“Neural probabilistic language models”,這其實還不算最早,更早的時候,Hinton就已經提出了distributed representation的概念“Learning distributed representations of concepts”(只不過不是用在word embedding上面) ,AAAI2015的時候問過Hinton怎麼看google的word2vec,他說自己20年前就已經搞過了,哈哈,估計指的就是這篇paper。

總之,常見的word embedding方法就是先從文字中為每個單詞構造一組features,然後對這組feature做distributed representations,哈哈,相比於傳統的distributed representations,區別就是多了一步(先從文件中為每個單詞構造一組feature)。

既然word embedding是一個老的topic,為什麼會火呢?原因是Tomas Mikolov在Google的時候發的這兩篇paper:“Efficient Estimation of Word Representations in Vector Space”、“Distributed Representations of Words and Phrases and their Compositionality”。

這兩篇paper中提出了一個word2vec的工具包,裡面包含了幾種word embedding的方法,這些方法有兩個特點。一個特點是速度快,另一個特點是得到的embedding vectors具備analogy性質。analogy性質類似於“A-B=C-D”這樣的結構,舉例說明:“北京-中國 = 巴黎-法國”。Tomas Mikolov認為具備這樣的性質,則說明得到的embedding vectors性質非常好,能夠model到語義。

這兩篇paper是2013年的工作,至今(2015.8),這兩篇paper的引用量早已經超好幾百,足以看出其影響力很大。當然,word embedding的方案還有很多,常見的word embedding的方法有:
1. Distributed Representations of Words and Phrases and their Compositionality
2. Efficient Estimation of Word Representations in Vector Space
3. GloVe Global Vectors forWord Representation
4. Neural probabilistic language models
5. Natural language processing (almost) from scratch
6. Learning word embeddings efficiently with noise contrastive estimation
7. A scalable hierarchical distributed language model
8. Three new graphical models for statistical language modelling
9. Improving word representations via global context and multiple word prototypes

word2vec中的模型至今(2015.8)還是存在不少未解之謎,因此就有不少papers嘗試去解釋其中一些謎團,或者建立其與其他模型之間的聯絡,下面是paper list
1. Neural Word Embeddings as Implicit Matrix Factorization
2. Linguistic Regularities in Sparse and Explicit Word Representation
3. Random Walks on Context Spaces Towards an Explanation of the Mysteries of Semantic Word Embeddings
4. word2vec Explained Deriving Mikolov et al.’s Negative Sampling Word Embedding Method
5. Linking GloVe with word2vec
6. Word Embedding Revisited: A New Representation Learning and Explicit Matrix Factorization Perspective