知识表示学习 (二) —— Gaussian space
文章目录
基于翻译的模型处理TransE及其变体的基于Point-Wise Space的模型,还有基于Gaussian space的模型,代表有KG2E、TransG等。
一、KG2E(2015)
论文链接:Learning to Represent Knowledge Graphs with Gaussian Embedding
Learning to represent knowledge graphs with gaussian embedding:高斯分步表示实体和关系
KG2E针对的问题:作者认为以前的方法都是将实体和关系嵌入到点向量空间中,这些模型总是以同样的方式看待所有的实体和关系,而实体库中的实体和关系本身就就存在不确定性,以前的方法模型忽略了这一不确定性。
作者指出了不确定性的多种影响因素:
- 关系两边的头实体和尾实体的不对称性
- 不同关系和实体连接的三元组数量的不同
- 关系的模糊不清
KG2E原理
KG2E不再采用点空间,而是采用基于密度的向量嵌入方法。作者使用Gaussian Distribution来表示实体和关系,用均值表示其所处的中心位置,用协方差来表示实体和关系的不确定度,采用KL散度用于对三元组进行打分。
论文中将每个关系和实体使用多维高斯分布 N ( μ , Σ ) \mathcal{N}(\mathcal{\mu},\mathcal{\Sigma}) N(μ,Σ)表示。
图示中,带有下划线的表示关系,每个圆圈代表不同实体和关系的表示。圆圈越大代表其不确定性越大,从图中能够看出nationality
这个关系的不确定性是最大的。
KG2E使用 h − t h-t h−t表示头尾实体之间的关系,可以计算得到概率分布表示:
P e ∼ N ( μ h − μ t , Σ h + Σ t ) \mathcal{P}_e\sim\mathcal{N}(\mathbf{\mu}_h-\mathbf{\mu}_t,\mathbf{\Sigma}_h+\mathbf{\Sigma}_t) Pe∼N(μh−μt,Σh+Σt)
关系的概率分布为:
P r ∼ N ( μ r , Σ r ) \mathcal{P}_r\sim\mathcal{N}(\mathbf{\mu}_r,\mathbf{\Sigma}_r) Pr∼N(μr,Σr)
然后可以评估 P e \mathcal{P}_e Pe和 P r \mathcal{P}_r Pr之间的相似度,论文中提出了两种评分方式。
1.非对称相似度:实体分布和关系分布之间的KL散度
E ( h , r , t ) = E ( P e , P r ) = D K L ( P e , P r ) = ∫ x ∈ R k e N ( x ; μ r , Σ r ) log N ( x ; μ e , Σ e ) N ( x ; μ r , Σ r ) d x = 1 2 { t r ( Σ r − 1 Σ e ) + ( μ r − μ e ) ⊤ Σ r − 1 ( μ r − μ e ) − log det ( Σ e ) det ( Σ r ) − k e } \begin{aligned} \mathcal{E}(h,r,t) & =\mathcal{E}(\mathcal{P}_e,\mathcal{P}_r)=\mathcal{D}_{\mathcal{KL}}(\mathcal{P}_e,\mathcal{P}_r) \\ & = \int_{x\in\mathcal{R}^{k_e}}\mathcal{N}(x;\mathbf{\mu}_r,\mathbf{\Sigma}_r)\log\frac{\mathcal{N}(x;\mathbf{\mu}_e,\mathbf{\Sigma}_e)}{\mathcal{N}(x;\mathbf{\mu}_r,\mathbf{\Sigma}_r)}dx \\ & = \frac{1}{2}\{tr(\mathbf{\Sigma}_r^{-1}\mathbf{\Sigma}_e)+(\mathbf{\mu}_r-\mathbf{\mu}_e)^{\top}\Sigma_r^{-1}(\mathbf{\mu}_r-\mathbf{\mu}_e)-\log\frac{\det(\Sigma_e)}{\det(\Sigma_r)}-k_e\} \end{aligned} E(h,r,t)=E(Pe,Pr)=DKL(Pe,Pr)=∫x∈RkeN(x;μr,Σr)logN(x;μr,Σr)N(x;μe,Σe)dx=21{ tr(Σr−1Σe)+(μr−μe)⊤Σr−1(μr−μe)−logdet(Σr)det(Σe)−ke}
定义基于KL散度的对称的相似度度量方法
E ( h , r , t ) = 1 2 ( D K L ( P e , P r ) + D K L ( P r , P e ) ) \mathcal{E}(h,r,t)=\frac{1}{2}(\mathcal{D}_{\mathcal{KL}}(\mathcal{P}_e,\mathcal{P}_r)+\mathcal{D}_{\mathcal{KL}}(\mathcal{P}_r,\mathcal{P}_e)) E(h,r,t)=21(DKL(Pe,Pr)+DKL(Pr,Pe))
2.对称相似度:采用期望似然,使用两个分布的内积作为度量两个分布的相似度。
E ( P e , P r ) = ∫ x ∈ R k e N ( x ; μ e , Σ e ) N ( x ; μ r , Σ r ) d x = N ( 0 ; μ e − μ r , Σ e + Σ r ) \begin{aligned} \mathcal{E}(\mathcal{P}_e,\mathcal{P}_r) & = \int_{x\in\mathcal{R}^{k_e}}\mathcal{N}(x;\mathbf{\mu}_e,\mathbf{\Sigma}_e)\mathcal{N}(x;\mathbf{\mu}_r,\mathbf{\Sigma}_r)dx \\ & = \mathcal{N}(0;\mathbf{\mu}_e-\mathbf{\mu}_r,\mathbf{\Sigma}_e+\mathbf{\Sigma}_r) \end{aligned} E(