knowledge graph embedding

Given a KG composed of a collections of triplet facts $\Omega=\{<h,r,t>\}$, and a pre-defined dimension of embedding space $d$, KG embedding aims to represent each entity $h\in E$ and relation $r\in R$ into a d-, contitnuous vector space, where each vectors can capture information of the graph.

triplet fact-based representation learning models

Triple fact-based embedding model treats the knowledge graph as a set of triplets containing all observed facts. Triple fact-based embedding models focus on modifying the calculation formula of the scoring function $f_r(h,t)$.

For the original triplet set $S$ , the set of corrupted triplets $S^\prime$ is generated accoring to $S^\prime=\{(h^\prime,r,t)|h^\prime\in E\}\cup\{(h,r,t^\prime)|t^\prime\in E\}$ then $S$ and $S^\prime$ incorporated as a batch trainig set $T_{batch}$ and there are two alternative versions of the loss function

These two functions can both be calculated by the SGD or Adam methods

Untitled

  1. translation-based models

    Translation invariance into the knowledge graph embedding field

    TransE - represents all entities and relations to the uniform continuous, low-, feature space $\R^d$

    the relations can be regarded as connection vectors between entities

    For each triplet (h,r,t), h,r,t are embedded to the embedding vectors $\bold h,\bold r, \bold t$ with folloing geometric principle: $\bold h+\bold r \approx\bold t$

    The score function defined by $f_r(h,t)=\|\bold h+\bold r-\bold t\|_{\ell_1/\ell_2}$

    TransE minimizes a margin-based ranking loss function over the training process

    $$ L=\sum_{(h,r,t)\in S}\sum_{(h^\prime,r^\prime,t^\prime)\in S^\prime}\max(0,\gamma+f_r(h,t)-f_{r^\prime}(h^\prime,t^\prime)) $$

    where $S$ and $S^\prime$ denote the set consisting of correct triplets and corrupted triplets, respectively, and $\gamma$ indicates the margin hyperparameter

    In training, TransE stochastically repalces the head or tail entity in each triplet with other candidate entities to generate corrupted triplet set $S^\prime$

    TransE has difficulty in dealin with complex relations, such as 1-N,N-1,N-N

    ex) 1-N relation $\forall i\in\{1,2,\cdots,n\}$, $(h,r,t_i)\in S$. According to the guidelines TransE followed $\bold h+\bold r\approx\bold t_i$, all embedding vctors the tail entities should be approximatedly simmilar, as $\bold t_1\approx\cdots\approx\bold t_i$.

    TransH

    each relation to hold its own relation-specific hyperplane

    an entity would have different embedding embeddingvectors in different relation hyperplanes

    For a relation $r$, TransH employs the replation-specific translation vector $\bold d_r$ and the normal vector of hyperplane $\bold w_r$. For each triplet fact (h,r,t), the embedding vectors of $\bold h$ and $\bold t$ are projected to the relation-specific hyperplane. $\bold h_\perp$ and $\bold t_\perp$ indicate the projections.

    $\bold h_\perp$ and $\bold t_\perp$ are connected by the relation-specific translation vector $\bold d_r$

    a small score is expected when (h,r,t) holds. $f_r(h,t)=\|\bold h_\perp+\bold d_r-\bold t_\perp\|_2^2$

    TransH can project an entity to different feature vectors depending on different relations.

    The entitis and relations in TransH are still represented in the same feature space $\R^d$.

    entity may contain various sementic meanings and different relations may concentrate on entities’ diverse aspects

    entities and relations in the same semantic space might make the model insufficient for graph embedding.

    TransR

    relation-specific hyperplanes → relation-specific spaces

    each triple (h,r,t), entities are embedded as $\bold h,\bold t\in\R^d$, relations are represented as a translation vector $\bold r$ into a relation-specific space $\R^k$

    TransR projects $\bold h$ and $\bold t$ from the entity space into the relation space

    for each relation $r$, TransR defines a projection matrix $\bold M_r\in\R^{k\times d}$ to transform the entity vectors into the relation-specific space. The projected entity vectors and the scoring fuction

    are

    $$ \bold h_\perp=\bold M_r\bold h, \ \bold t_\perp=\bold M_r\bold t\\ f_r(h,t)=\|\bold h_\perp+\bold r-\bold t_\perp\|_2^2 $$

    For a relation r, the head and tail entities share the same projection matrix $\bold M_r$, whereas it is intuitive that the types or attributes between head and tail entities my be essentially different.

    The projection from the entity space to the relation-specific is an interactive process between entities and relations it cannot capture integrated information when the projection matrix is generated only related to relations.

    TransR requires a large amount of computing resources, the memory complexity of which is $\mathcal O(N_ed+N_rdk)$ compared to TransE and TransH with $\mathcal O(N_ed+N_rk)$

    TransD

    Given a triplet (h,r,t), each entity and relation is represented to two embedding vectors

    ($\bold h,\bold h_p,\bold t,\bold t_p\in\R^d$ and $\bold r,\bold r_p\in\R^k$) with

    $$ \bold M_{rh}=\bold r_p\bold h_p^T+\bold I,\ \bold M_{rt}=\bold r_p\bold t_p^T+\bold I $$

    where $\bold I^{k\times d}$ is an identity matrix and $\bold M_{rh},\bold M_{rt}\in\R^{k\times d}$ are dynamic projection matrices

    The projection matrix involve both entity and relation, and the embedding vectors of $\bold h$ and $\bold t$ and score function are defined as:

    $$ \bold h_\perp=\bold M_{rh}\bold h,\ \bold t_\perp=\bold M_{rt}\bold t\\ f_r(h,t)=\|\bold h_\perp+\bold r-\bold t_\perp\|_2^2 $$

    It constructs a dynamic mapping matrix with two projection vectors, that effectually reduces the computation complexity to $\mathcal O(N_ed+N_rk)$

    Trans E,H,R,D ignore

    heterogeneity - some relations have many connections with entities and others do not, causes underfitting on complex relations or overfitting on simple relations

    imbalance - there is a great difference between haed and tail entities for a relation in quatities, indicates that the model should treat head and tail entities differently

    TransSparse

    share leverage adaptive sparse matrices $\bold M_r(\theta_r)$ to replace dense projection matrices for each relation $r$

    The sparse degree $\theta_r$ is linked to the number of entities connected with the relation $r$, with

    $\theta_r=1-(1-\theta_\text{min})N_r/N_{r^}$where $0\leq\theta_\text{min}\leq1$ is a hyperparameter, $N_r$ the number of entity pairs connected with the relation $N_{r^}$ the maximum of them

    The projected vectors are

    $$ \bold h_\perp=\bold M_r(\theta_r)\bold h,\ \bold t_\perp=\bold M_r(\theta_r)\bold t $$

    separate sparse degree and the projected vectors are extended as

    $$ \theta_{rl}=1-(1-\theta_\text{min})N_{rl}/N_{r^l^}\ (l=h,t)\\ \bold h_\perp=\bold M_{rh}(\theta_{rh})\bold h,\ \bold t_\perp=\bold M_{rt}(\theta_{rt})\bold t $$

    sTransE the sparse projection matrices $\bold M_{rh}(\theta_{rh}),\bold M_{rt}(\theta_{rt})$ are replaced by mapping matrices $\bold M_{rh},\bold M_{rt}$ the projected vectors are transformed to

    $$ \bold h_\perp=\bold M_{rh}\bold h,\ \bold t_\perp=\bold M_{rh}\bold t $$

    TransA

    Given a triplet (h,r,t), $\bold M_r$ is defined as asymmetric non-negative weight matrix with relation r; the score function of TransA is $f_r(h,t)=(|\bold h+\bold r-\bold t|)^T\bold M_r(|\bold h+\bold r-\bold t|)$ where $|\bold h+\bold r-\bold t|=(|h_1+r_1-t_1|,|h_2+r_2-t_2|,\cdots,|h_d+r_d-t_d|)$

    Mahalanobis distance as a better indicatorto repace the traditional Euclidean distance becuase Mahalanobis distance shows better adaptability and flexibility

    KG2E

    introduces the uncertainty to construct a probabilistic knowledge graph embedding model

    each entity and relations is represented $\bold h\sim\mathcal N(\mu_h,\Sigma_h),\ \bold r\sim\mathcal N(\mu_r,\Sigma_r),\ \bold t\sim\mathcal N(\mu_t,\Sigma_t)$. Here, $\mu_h,\mu_r,\mu_t\in\R^d$, and $\Sigma_h,\Sigma_r,\Sigma_t\in\R^{d\times d}$. The mean of this Gausssian distribution is the position of the entity or relation in a semantic feature space, and the covariance signifies the uncertainty of the entity or relation.

    KG2E utilze the distance betwwen $\bold h-\bold t$ and $\bold r$ as metric to distinguish the authenticity of triplets, where the traditional $\bold h-\bold t$ is transformed to the distribution formula of $\mathcal N(\mu_h-\mu_t,\Sigma_h-\Sigma_t)$

    two categories of approaches to estimate the similarity between two probability distributions : Kullback-Leibler divergence and expected likelihood

    TransG

    when a relations ship is associated with different entity pairs, it may contain multiple sementics.

    It leverages a Gaussian mixture model to represent relations:

    $$ \bold h\sim\mathcal N(\mu_h,\sigma_h^2\bold I),\ \bold t\sim\mathcal N(\mu_t,\sigma_t^2\bold I)\\ \bold r\sim\sum_{m=1}^M\pi_{r,m}\mathcal N(\mu_h-\mu_t,(\sigma_h^2+\sigma_t^2)\bold I) $$

    $\pi_{r,m}$ is the weight of distinct sementics

    TransG can find the incorrect entities by utilizing multiple semantic component

  2. tensor factorization-based models

    1. the triplet facts in the KG are transformed into a 3D binary tensor $\Chi$

      given a tensro $\Chi\in\R^{n\times n\times m}$ (n: the number of entities, m: the nubmerof relations)

      $\Chi_k \ (k=1,\cdots,m)$ corresponds to a relation type $R_k$

      $\Chi_{ijk}=1$ : triplet (i-th enittym, k-th relation, j-th entity) exists in the graph;

      $\Chi_{ijk}=0$ : non-existent or unknown triplet

    2. the embedding matrices associated with the embedding vectors of the entities and relations are calculated to represent $\Chi$ as some factors of a tensor

    3. low-, representation for each entity and relation is generated along with these embedding matrices

    RESCAL

    use the rank-d factorization to obtain its latent sementics

    $$ \Chi_k\approx AR_kA^T,\ k=1,\cdots,m $$

    where $A\in\R^{n\times d}$ is a matrix that captures the latnet semantic representation of entities and $R_k\in\R^{d\times d}$ is a matrix that models the pairwise interactions in the k-the relation

    the scoring function $f_r(h,t)=\bold h^T\bold M_r\bold t$, here , $\bold M_r\in\R^{d\times d}$ represents the latent semantic meanings in the relation. $\bold h_i,\bold t_j\in\R^d$ represent the embedding vectors of the i-th, j-th entity are assigned by the values of the i-th and j-th row of matrix $A$

    This method requires $\mathcal O(N_ed+N_rk^2)\ (d=k)$ parameters

    DistMult

    To simplyfy the computational complexity of RESCAL, DistMult restricts $\bold M_r$ to be diagonal marices

    the scroing function $f_r(h,t)=\bold h^T\text{diag}(\bold r)\bold t$

    Hole

    circular correlation operation, denoted as $\star:\R^d\times\R^d\rightarrow\R^d$, with $[\bold h\star\bold t]k=\sum{i=0}^{d-1}h_it_{(k+i) \text{mod} \ d}$ whose computational process can be accerlerated via

    $$ \bold h\star\bold t=\mathcal F^{-1}(\overline{\mathcal F(\bold h)}\cdot\mathcal F(\bold t)) $$

    where $\mathcal F(\cdot)$ : the fast Fourier transform, $\mathcal F^{-1}(\cdot)$: its inverse, $\overline{\bold a}$ : complex conjugate of $\bold a$

    score function $f_r(h,t)=\bold r^T(\bold h\star\bold t)$

    Note that circular correlation is not commutative, this property is indispensable for modeling asymmetric relations to semantic representation space

    Complex (extend for DistMult)

    embeddings of entities and relations exist in the $\mathbb C^d$

    scoring function $f_r(h,t)=\text{Re}(\bold h^T\text{diag}(\bold r)\bar{\bold t})$

    triplets that have asymmetric relation can obtain different scores depending on the sequence of entities

    SimplE

    scoring function $f_r(h,t)=\frac{1}{2}((\bold h\circ\bold r)\cdot\bold t+(\bold t\circ\bold r^\prime)\cdot\bold h)$

    where $\circ$ is the element-wise multiplication and $\bold r^\prime$ indicates the embedding vector of reverse relation

  3. neural network-based models

Description-Based Representation Learning Models

  1. Textual Desciption-Based models
  2. Relation Path-Based Models

Link Prediction

The goal is to predict a lacking entity when given a concrete entity and relation.

It intends to predict $h$ when given $(r,t)$ or $r$ when given $(h,t)$, indicated as $(h,r,?)$ and $(?,r,t)$

Given a test triplet (h,r,t), th true tail entity is replaced by envery entity $e$ in the entity candidate set.

For each iteration, the authenticity of the corrupted triplet ((h,r,e)) is calculated according to the score function $f_r(h,e)$