接上节课没讲完的word2vec
word2vec(续)
训练策略:
SGD
![](https://i-blog.csdnimg.cn/blog_migrate/9e2b1941c1d8c507e697a700e488afbf.png)
![](https://i-blog.csdnimg.cn/blog_migrate/42be5dca011ae28d8ea89df58d886a38.png)
Word2vec使用SGD训练存在的问题:
每次只有窗口内的词会参与训练,梯度矩阵太稀疏,训练效率低。
![](https://i-blog.csdnimg.cn/blog_migrate/e02a6e0eaed2ed4d3d4231f4a1cd099c.png)
![](https://i-blog.csdnimg.cn/blog_migrate/9a754d293aa5aaabadf9bb9a9d799fc7.png)
优化方法:
1.negative sampling
转化为二分类问题
![](https://i-blog.csdnimg.cn/blog_migrate/40ec0d9e95a595ac790c4d93d4bc5ceb.png)
![](https://i-blog.csdnimg.cn/blog_migrate/0f3942c9e574f41543120b8d0a3eed6d.png)
![](https://i-blog.csdnimg.cn/blog_migrate/fbefc1b1cb310770b738a3e56929f9ad.png)
2.hierarchical softmax
Glove
![](https://i-blog.csdnimg.cn/blog_migrate/198db48d2aed73a1054166f2f1dbe37c.png)
![](https://i-blog.csdnimg.cn/blog_migrate/1678827a5aea2e79737a75d5fdd58c43.png)
![](https://i-blog.csdnimg.cn/blog_migrate/4a459c85969218660c706478e4154793.png)
公式推导参考这里
词向量评估
![](https://i-blog.csdnimg.cn/blog_migrate/cfbfb4b33a0e1ad3a884f45bd218f909.png)
![](https://i-blog.csdnimg.cn/blog_migrate/10b226752da76a80735684b3f4605969.png)
![](https://i-blog.csdnimg.cn/blog_migrate/bb5c439cf3dfa12b1d51b8ab9d238164.png)
词向量存在的问题
多义词
![](https://i-blog.csdnimg.cn/blog_migrate/7a986c1ac5ef9940844e60f08ec09db5.png)
接上节课没讲完的word2vec
SGD
每次只有窗口内的词会参与训练,梯度矩阵太稀疏,训练效率低。
1.negative sampling
转化为二分类问题
2.hierarchical softmax
公式推导参考这里
多义词