一、模型介绍
1.产生背景
Wordvec对每个local context window单独训练,没有利用包含在global co-corrence矩阵中的统计信息
2.推导
Pij = P(j | i) =Xij/Xi :the probability that word j appear in the context of word i
例子:i = ice and j = steam
For words k related to ice but not steam, say k = solid, we expect the ratio Pik/Pjk will be large
For words k like fashion, that are either related to both ice and steam, or to neither, the ratio should be close to 1.
其中,F是exp函数,经过一番推导后得到这个结论
3.训练
最后,得出训练函数
其中f函数:很少出现的共现对的干扰性比较强,用来降权
二、源码解析
三、跑demo
因为近期想自己构造一些语料库来训练词向量,所以第一步就是glove的demo跑通
下载之后编译老遇到问题 一开始是
网上查资料并不多,都说可能是gcc版本的问题,于是乎我按照收藏里的一篇博客更新了gcc版本到7.3.0
然鹅,又遇到一个问题 大概是些 assembler messages,都报suffix or operands invaild for ' '
在小群里请教大家后有个大佬给出解答 更新下binutils 或者 更新gcc 或者编译优化开低
我按照这篇博客更新binutils之后就解决了诶