[Word2Vec系列][EMNLP 2014]GloVe

https://pdfs.semanticscholar.org/b397/ed9a08ca46566aa8c35be51e6b466643e5fb.pdf

Intro

The two main model families for learning word vectors are: 1) global matrix factorization meth- ods, such as latent semantic analysis (LSA) (Deer- wester et al., 1990) and 2) local context window methods, such as the skip-gram model of Mikolov et al. (2013c)
词向量表示主要两种方法: LSA,local context window
While methods like LSA efficiently leverage statistical information, they do relatively poorly on the word analogy task, indicating a sub-optimal vector space structure. Methods like skip-gram may do better on the analogy task, but they poorly utilize the statistics of the corpus since they train on separate local context win- dows instead of on global co-occurrence counts.
这两种方法都有缺点
GloVe一定程度上吸收了两个的有点

Related

In the skip-gram and ivLBL models, the objective is to predict a word’s context given the word itself, whereas the objective in the CBOW and vLBL models is to predict a word given its context.
Word2Vec的两种算法,一种根据中心单词预测上下文,一种根据上下文预测中心单词
suffer from the disadvantage that they do not operate directly on the co-occurrence statistics of the corpus.
缺点在于没有利用到共生矩阵里面的数值信息,大量的重复信息没有好好利用

Model

X word-word co-occurrence matrix
Xij number of times word j occurs in the context of word i
Xi number of times any word appears in the context of word i
Pij = P(j|i) = Xij/Xi probability that word j appear in the context of word i.

一个有趣的事情是,对于Pik, Pjk,给定k,求Pik/Pjk的比例,可以区分跟i(或j)相关的词
Compared to the raw probabilities, the ratio is better able to distinguish relevant words from irrelevant words and it is also better able to discriminate between the two relevant words.
比如i = ice, j = steam
solid跟ice比较相关跟steam无关,所以Pik/Pjk比较大
反之,gas跟ice比较无关跟steam比较相关,所以Pik/Pjk比较小
同时water跟ice, steam都比较相关,fashion跟两者都无关,所以Pik/Pjk趋向于1

Pik/Pjk

定义
![](http://www.forkosh.com/mathtex.cgi? F(w_i, w_j, \widetilde{w}k)=\frac{P{ik}}{P_{jk}})
其中w是词向量, 这是在向量空间的比例
左边是向量操作,右边是数值
Since vector spaces are inherently linear structures, the most natural way to do this is with vector differences
搞发搞发,求个差
![](http://www.forkosh.com/mathtex.cgi? F(w_i- w_j, \widetilde{w}k)=\frac{P{ik}}{P_{jk}})
While F could be taken to be a complicated function parameterized by, e.g., a neural network, do- ing so would obfuscate the linear structure we are trying to capture. To avoid this issue, we can first take the dot product of the arguments
搞发搞发,变点乘。(为了不混淆向量维度)
![](http://www.forkosh.com/mathtex.cgi? F((w_i-w_j)^T\widetilde{w}k=\frac{P{ik}}{P_{jk}})

<font color=gray>不是很明白这里的搞发搞发</font>

一个词(word)或者上下文的词(context word)其实是可以交换角色的,共生矩阵也应该是满足X^T=X的,但是上面这个式子却并不总满足这种对称性
但是,假如![](http://www.forkosh.com/mathtex.cgi? F((w_i-w_j)^T \widetilde{w}k=\frac{F(w_iT\widetilde{w}_k)}{F(w_jT\widetilde{w}k)})
就可以了
<font color=gray>不是很明白为什么这样就可以了</font>
这个时候![](http://www.forkosh.com/mathtex.cgi? F(w_i^T\widetilde{w}k) = P{ik} = \frac{X
{ik}}{X_i})
F是exp函数,两边都取log的话
![](http://www.forkosh.com/mathtex.cgi? w_i^T\widetilde{w}k = log(P{ik}) = log(X_{ik})-log(X_i))
X_i是一个跟k无关的量,所以可以作为bias被$$X
{ik}$$吸收进去。b_i for w_i
所以最终的式子,保证了上述的对称性
![](http://www.forkosh.com/mathtex.cgi? w_i^T\widetilde{w}k + b_i + \widetilde{b}k = log(X{ik}))
log操作可以遇到log(0)的情况,可以用log(1+X
{ik})代替log(X_{ik})

A main drawback to this model is that it weighs all co-occurrences equally, even those that happen rarely or never.
缺点是,rare的词权重跟normal的词一样

最终的loss function
![](http://www.forkosh.com/mathtex.cgi? J = \sum_{i,j=1}V{f(X_{ij})[{w_iT\widetilde{w}_i + b_i + \widetilde{b}j - log(X{ij})}]^2 )

f(X_{ij})是weight
V是词汇量

f要满足三个特性:

  1. f(0) = 0,或者极限在0处值为0
  2. f (x) should be non-decreasing so that rare co-occurrences are not overweighted.
  3. f ( x ) should be relatively small for large val- ues of x, so that frequent co-occurrences are not overweighted.

找了一个f:
![](http://www.forkosh.com/mathtex.cgi? f(x)=\begin{cases} (x/x_{max})^\alpha & \text{$x<x_{max}$}\ 1& \text{otherwise} \end{cases})

f(.)
摘抄自52nlp
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 158,736评论 4 362
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,167评论 1 291
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 108,442评论 0 243
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,902评论 0 204
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,302评论 3 287
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,573评论 1 216
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,847评论 2 312
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,562评论 0 197
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,260评论 1 241
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,531评论 2 245
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,021评论 1 258
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,367评论 2 253
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,016评论 3 235
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,068评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,827评论 0 194
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,610评论 2 274
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,514评论 2 269

推荐阅读更多精彩内容

  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 8,574评论 0 23
  • Sherlock Holmes 三年的时间精雕细琢的这道盛宴,连王室都在翘首以盼,英国...
    安安然_阅读 561评论 0 0
  • 老师给我们发美味可口的糖葫芦。她刚把糖葫芦拿出来,大家就疯狂地抢起来,只听“啊——"的一声,冰糖葫芦就被抢光了。老...
    文章里的故事阅读 128评论 0 1
  • 警方根据与孟书往来频繁的名单查到了清音的号码和住址。 去警局的路上,清音在脑海中不断回放着这段听到的话语。 “你认...
    a48d4bdef9d1阅读 246评论 0 1
  • 您或您的孩子经常流鼻血吗? 现在分享您一个小验方,试试吧!也许就解决了您许久以来的烦恼了呢! 我爷爷是老中医,这个...
    梓毓爸阅读 762评论 0 2