文献阅读 - From Word Embeddings To Document Distances

From Word Embeddings To Document Distances


M. J. Kusner, Y. Sun, N. I. Kolkin, K. Q. Weinberger, From Word Embeddings To Document Distances, ICML (2015)


摘要

词嵌入(word embedding):根据单词在语句中的局部共存性,学习单词语义层面的表示(semantically meaningful representations for words)。

单词移动距离(Word Mover’s Distance,WMD):基于词嵌入,衡量文本文档(text documents)间距离的函数。WMD以一个文档的嵌入词移动至另一个文档的嵌入词的最小距离(the minimum amount of distance that the embedded words of one document need to “travel” to reach the embedded words of another document)作为两个文本文档间不相似度(dissimilarity)的度量。

WMD测度不包含超参数(hyperparameters)。

1 引言

文档表示的最常用的两种方法:

  1. 词袋模型(bag of words,BOW);
  2. 词频逆文档频率(term frequency - inverse document frequency,TF-IDF)。

由于各文档的BOW(TF-IDF)表示通常近似正交性(frequent near-orthogonality),二者并不适于度量文档距离;另外,二者无法表示不同单词间的距离(not capture the distance between individual words)。

文档的低维隐含变量表示(a latent low-dimensional representation of documents):

  1. 隐含语义索引(Latent Semantic Indexing,LSI):对BOW特征空间(feature space)进行特征分解(eigendecompose);
  2. 主体模型(Latent Dirichlet Allocation,LDA):将相似词按概率分配到不同的主题(probabilistically groups similar words into topics),并将文档表示这些主题的分布(represents documents as distribution over these topics)

通常,语义关系体现在词向量的运算上(semantic relationships are often preserved in vector operations on word vectors),即嵌入词向量间的距离能够表示语义(distances between embedded word vectors are to some degree semantically meaningful)。本文将文本文档表示为嵌入词的加权点云(a weighted point cloud of embedded words),文本文档 A A A B B B间的单词移动距离(Word Mover’s Distance,WMD)定义为:为匹配(match)文档 B B B的点云(point cloud),文档 A A A中的单词(words from document A A A)所需移动(travel)的最小累积距离(minimum cumulative distance),Fig. 1。

在这里插入图片描述
WMD最优问题是最短测地距离(Earth Mover’s Distance,EWD)运输问题(transportation problem)的特例。本文给出几个下界距离(lower bounds)用于近似WMD或对查询范围剪枝(approximations or to prune away documents that are provably not amongst the k k k-nearest neighbors of a query)。

WMD特性:(1)无超参(hyper-parameter free);(2)可解释性强(highly interpretable),文档距离可解释为少量不同单词间的稀疏距离(the distance between two documents can be broken down and explained as the sparse distances between few individual words);(3)高检索准确率(high retrieval accuracy)。

2 相关工作

Okapi BM25

LDA

LSI

TextTiling-EMD

Stacked Denoising Autoencoders (SDA)、mSDA

Componential Counting Grid

3 Word2Vec词嵌入(Word2Vec Embedding)

word2vec:词嵌入过程(word-embedding procedure),使用(浅层)神经网络语言模型(a (shallow) neural network language model)学习单词的向量表示(vector representation)。

skip-gram模型:由输入层、投影层(a projection layer)和输出层组成,用于预测相邻单词(nearby words)。通过最大化语料库(corpus)中相邻单词(neighboring words)的对数概率(log probability),训练各单词词向量(word vector),即给定单词序列(a sequence of words) w 1 , ⋯   , w T w_{1}, \cdots, w_{T} w1,,wT

1 T ∑ t = 1 T ∑ j ∈ n b ( t ) log ⁡ p ( w j ∣ w t ) \frac{1}{T} \sum_{t = 1}^{T} \sum_{j \in nb(t)} \log p(w_{j} | w_{t}) T1t=1Tjnb(t)logp(wjwt)

其中, n b ( t ) nb(t) nb(t)表示单词 t t t的相邻单词集合、 p ( w j ∣ w t ) p(w_{j} | w_{t}) p(wjwt)表示相应词向量(associated word vectors) v w j \mathbf{v}_{w_{j}} vwj v w t \mathbf{v}_{w_{t}} vwt之间的层级归一化指数(hierarchical softmax)。由于结构简单和层级归一化指数,skip-gram能够使用台式机在数十亿单词上训练(due to its surprisingly simple architecture and the use of the hierarchical softmax, the skip-gram model can be trained on a single machine on billions of words per hour using a conventional desktop computer),因此能学到复杂的单词关系。

4 WMD距离(Word Mover’s Distance)

X ∈ R d × n \mathbf{X} \in \R^{d \times n} XRd×n表示 n n n个单词的word2vec嵌入矩阵(a word2vec embedding matrix),其第 i i i x i ∈ R d \mathbf{x}_{i} \in \R^{d} xiRd表示第 i i i个单词在 d d d维空间中的词嵌入。假设文本文档表示为归一化词袋模型(normalized bag-of-words,nBOW)向量 d ∈ R n \mathbf{d} \in \R^{n} dRn,即如果单词 i i i出现 c i c_{i} ci次,则 d i = c i ∑ j = 1 n c j d_{i} = \frac{c_{i}}{\sum_{j = 1}^{n} c_{j}} di=j=1ncjci。通常,nBOW向量 d \mathbf{d} d非常稀疏(very sparse)。

n n nBOW( n n nBOW representation)

向量 d \mathbf{d} d n − 1 n - 1 n1维单纯形(simplex),包含不同唯一词的两文档(different unique words)位于单纯形不同的区域中,但这两个文档的语义确可能相近(semantically close)。

词映射损失(word travel cost)

本文将单词对(individual word pairs)间的语义相似度(document distance metric)包含进文档距离度量(document distance metric)。单词不相似度通常采用在word2vec嵌入空间(the word2vec embedding space)中的欧氏距离(Euclidean distance)度量。单词 i i i j j j之间的距离为: c ( i , j ) = ∥ x i − x j ∥ 2 c(i, j) = \| \mathbf{x}_{i} - \mathbf{x}_{j} \|_{2} c(i,j)=xixj2,表示一个单词移动到另一个单词的代价(the cost associated with “traveling” from one word to another)。

文档距离(document distance)

(1)令 d \mathbf{d} d d ′ \mathbf{d}^{\prime} d表示两个文档在 n − 1 n - 1 n1维单纯形(simplex)上的 n n nBOW表示。

(2)假定 d \mathbf{d} d中的每个单词 i i i都可以全部或部分映射到 d ′ \mathbf{d}^{\prime} d

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值