# Link Prediction Based on Feature Mapping and Bi-Directional Convolution
## 3 Model Details
### Encoding Layer  
In order to obtain the embedding of entities and relations, it is necessary to learn the representation of each ternary. We have the entity, and relation feature vectors of the single-hop triad \(t_{i_{j},i_{s}}^{m_{s}}=(e_{i_{s}},r_{m_{s}},e_{i_{s}})\) and the multi-hop triad \(t_{i_{j},i_{k},i_{d}}^{m_{s}n_{d}}=(e_{i_{d}},r_{m_{d}},e_{i_{d}},r_{n_{d}},e_{ k_{d}})\) are concatenated to obtain a richer ternary representation. Multi-hop ternary can carry more information between entities and relations, which will only make the embedding richer. Firstly, the single-hop and multi-hop ternary are merged, where \(t\) denotes the ternary, \(s\) denotes the single-hop information, \(d\) denotes the multi-hop information, \(e_{i_{s}},e_{i_{p}},e_{i_{d}},e_{k_{d}}\) denote entity embeddings, and \(r_{m_{s}},r_{m_{d}},r_{n_{d}}\) denote relation embeddings. First, the single-hop and multi-hop triples are merged as follows.  
\[h_{i}=concat[e_{i_{s}},e_{i_{d}}] \tag{1}\]  
\[h_{j}=concat[e_{j},e_{k_{d}}] \tag{2}\]  
\[g_{k}=concat[r_{m_{s}},r_{m_{d}},r_{n_{d}}] \tag{3}\]  
The linear transformation is then performed with the following equation.  
\[c_{ijk}=[h_{i}||g_{k}||h_{j}] \tag{4}\]  
where \(c_{ijk}\) is the vector representation of the triplet after linear transformation, the matrix \(h_{i}\) represents the embedding of the entities \(e_{i_{s}},e_{i_{d}}\), the matrix \(h_{j}\) represents the embedding of the entities \(e_{i_{s}},e_{k_{d}}\), and the matrix \(g_{k}\) represents the embedding of the relations \(r_{m_{s}},r_{m_{d}},r_{n_{d}}\).  
We perform a linear transformation parameterized by the weight matrix \(W_{1}\) and then operate on it via the activation function LeakyRelu to obtain the absolute attention \(b_{ijk}\) of the ternary with the following formula.  
\[b_{ijk}=LeakyReLU(W_{1}c_{ijk}) \tag{5}\]  
Figure 1: Overall model diagram divided into three parts: (**a**) encoding layer, (**b**) mapping layer, and (**c**) decoding layer.  
To obtain the relative attention \(\alpha_{ijk}\), the activation function softmax is applied to the following equation.  
\[\alpha_{ijk}=Softmax_{jk}(b_{ijk}) \tag{6}\]  
The embedding \(h^{\prime}_{i}\) of entity \(e_{i}\) is the sum of each ternary representation weighted by their attention values, as shown in the following equation.  
\[h^{\prime}_{i}=\sigma(\sum_{j\in N_{i}}\sum_{k\in R_{ij}}\alpha_{ijk}\epsilon_{ ijk}) \tag{7}\]  
where \(N_{i}\) denotes the neighborhood of entity \(e_{i}\) and \(R_{ij}\) denotes the set of relations connecting entity \(e_{i}\) and \(e_{j}\). To stabilize the learning process and encapsulate more information about the neighborhood, the attention mechanism calculates the embedding and then connects the embeddings with the following equation.  
\[h^{\prime}_{i}=\sum_{m=1}^{M}\sigma(\sum_{j\in N_{i}}\sum_{k\in R_{ij}}\alpha_ {ijk}^{m}c_{ijk}^{m}) \tag{8}\]  
In the last layer of the model, rather than joining the embeddings of multiple heads, an averaging method is used to obtain the final embedding vector of the entity, as shown in the following equation.  
\[h^{\prime}_{i}=\sigma(\frac{1}{M}\sum_{m=1}^{M}\sum_{j\in N_{i}}\sum_{k\in R_{ ij}}\alpha_{ijk}^{m}c_{ijk}^{  
\[t_{\perp}=t-w_{\gamma}^{\top}tw_{r}, \tag{13}\]