Word embeding

给word 加feature,用来区分word 之间的不同,或者识别word之间的相似性.

  

用于学习 Embeding matrix E 的数据集非常大,比如 1B - 100B 的word corpos. 所以即使你输入的是没见过的 durian cutivator 也知道和 orange farmer 很相近. 这是transfter learning 的一个case.

  

  

  

  

因为t-SNE 做了non-liner 的转化,所以在原来的300维空间的平行的向量在转化过后的2D空间里基本上不会再平行.

  

看两个向量的相似性,可以用cosine similarity.

  

  

说了这么久 word embeding E 有这么大的用处,那E是怎么得到的呢?下面讲怎么learn embeding.

Learning embedings:Word2Vec&GloVe

就是怎么得到 E。

下图提到的在附近找一个词来做context 预测 target 词,就是Skip Gram 算法.

  

研究人员发现如果你真想要 build language model, 很自然的选择最近的一些words 作为context; 如果你是为了learn word embeding, 你可以选择任意下面的context都能得到很好的结果.

  

Word2Vec

前面讲了使用前4个word来学习参数 E 进而预测target word, 这里讲用1个word 来学习E并用来预测target word. 下图就是Word2Vec 的 Skip-grams model,还有一个叫 CBow.

  

Word2Vec 最大的问题就是计算p(t|c) 时候计算量很大.下图提到了hierachial softmax 的概念是一个解决的思路.

  

接下里有两种算法来解决上面讲到的softmax计算量大的问题

Negagtive Sampling

  

这个negative sampling model 把一次性计算softmax (在我们的例子里softmax 输出的维度是10k), 改成了多(10k)次(1个positive example, 4个随机选取的negative example)计算sigmoid.

  

到底怎么随机选取negative sampling 呢?去绝对随机,还是有什么方法?有两种极端,一种是根据经验取常见的word, 还有一种是在vacab 里绝对的随机选取,都不好, 下面给出了一个经验公式.但是我没搞懂那个p(wi) 怎么用到实际的选取中.

  

GloVe

  

  

  

Sentiment Classification

情感分析一个大问题是没有足够的label dataset.

Coursera, Deep Learning 5, Sequence Models, week2, Natural Language Processing & Word Embeddings的更多相关文章

  1. Coursera, Deep Learning 5, Sequence Models, week3, Sequence models & Attention mechanism

    Sequence to Sequence models basic sequence-to-sequence model: basic image-to-sequence or called imag ...

  2. 课程五(Sequence Models),第二 周(Natural Language Processing & Word Embeddings) —— 1.Programming assignments:Operations on word vectors - Debiasing

    Operations on word vectors Welcome to your first assignment of this week! Because word embeddings ar ...

  3. Coursera Deep Learning笔记 序列模型(二)NLP & Word Embeddings(自然语言处理与词嵌入)

    参考 1. Word Representation 之前介绍用词汇表表示单词,使用one-hot 向量表示词,缺点:它使每个词孤立起来,使得算法对相关词的泛化能力不强. 从上图可以看出相似的单词分布距 ...

  4. Coursera, Deep Learning 5, Sequence Models, week1 Recurrent Neural Networks

    有哪些sequence model Notation: RNN - Recurrent Neural Network 传统NN 在解决sequence input 时有什么问题? RNN就没有上面的问 ...

  5. 课程五(Sequence Models),第二 周(Natural Language Processing & Word Embeddings) —— 2.Programming assignments:Emojify

    Emojify! Welcome to the second assignment of Week 2. You are going to use word vector representation ...

  6. 课程五(Sequence Models),第二 周(Natural Language Processing & Word Embeddings) —— 0.Practice questions:Natural Language Processing & Word Embeddings

    [解释] The dimension of word vectors is usually smaller than the size of the vocabulary. Most common s ...

  7. Predicting effects of noncoding variants with deep learning–based sequence model | 基于深度学习的序列模型预测非编码区变异的影响

    Predicting effects of noncoding variants with deep learning–based sequence model PDF Interpreting no ...

  8. 吴恩达《深度学习》-课后测验-第五门课 序列模型(Sequence Models)-Week 2: Natural Language Processing and Word Embeddings (第二周测验:自然语言处理与词嵌入)

    Week 2 Quiz: Natural Language Processing and Word Embeddings (第二周测验:自然语言处理与词嵌入) 1.Suppose you learn ...

  9. [C5W2] Sequence Models - Natural Language Processing and Word Embeddings

    第二周 自然语言处理与词嵌入(Natural Language Processing and Word Embeddings) 词汇表征(Word Representation) 上周我们学习了 RN ...

随机推荐

  1. Spring Boot 1.X和2.X优雅重启实战

    纯洁的微笑 今天 项目在重新发布的过程中,如果有的请求时间比较长,还没执行完成,此时重启的话就会导致请求中断,影响业务功能,优雅重启可以保证在停止的时候,不接收外部的新的请求,等待未完成的请求执行完成 ...

  2. 【ZJOI2007】粒子运动

    若此段起始点为(stx,sty),速度为(vx,vy),设碰撞时间为t,则(stx+vx·t)²+(sty+vy·t)²=r² → stx²+vx²·t²+2·stx·vx·t+sty²+vy²·t² ...

  3. 【洛谷P2127】序列排序

    题目大意:给定一个长度为 N 的序列,序列中的数两两不相同,每次可以交换序列中任意两个数,代价为这两个数的和,问将序列调整为升序,最少的代价是多少. 题解:考虑这个问题的一个子问题,这个序列为 N 的 ...

  4. session/cookie/token

    1.cookie是把登录信息存放在客户端 2.session是把登录信息存放在服务器 3.token是在登录的时候服务器提供一个令牌标识,可以存放在local storage,请求资源时带上token ...

  5. HDU4560 二分最大流

    http://acm.hdu.edu.cn/showproblem.php?pid=4560 网络流好像经常搭配上二分和拆点. n个歌手,m种歌曲流派(n<=m<=75) 我们想要安排尽可 ...

  6. Tensorflow object detection API 搭建物体识别模型(二)

    二.数据准备 1)下载图片 图片来源于ImageNet中的鲤鱼分类,下载地址:https://pan.baidu.com/s/1Ry0ywIXVInGxeHi3uu608g 提取码: wib3 在桌面 ...

  7. Zookeeper+Kafka完全分布式实战部署

    Zookeeper+Kafka完全分布式实战部署 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 其实我之前部署过kafak和zookeeper的完全分布式,集群是可以正常使用没错, ...

  8. JAVA核心技术I---JAVA基础知识(时间类)

    一:时间类库了解 java.util.Date(基本废弃,Deprecated) –getTime(),返回自1970..1以来的毫秒数 java.sql.Date(和数据库对应的时间类) //与数据 ...

  9. python while 格式化 运算符 编码

    #######################总结############# 1. 循环 while 条件: 循环体(break, continue) 循环的执行过程: 执行到while的时候. 首先 ...

  10. Hadoop记录-Hadoop NameNode 高可用 (High Availability) 实现解析

    Hadoop NameNode 高可用 (High Availability) 实现解析   NameNode 高可用整体架构概述 在 Hadoop 1.0 时代,Hadoop 的两大核心组件 HDF ...