# Entity Alignment Method Based on Joint Learning of Entity and Attribute Representations
## 2 Materials and Methods
### Embedding Learning
#### 2.3.3 Improved Loss Function for Embedded Learning  
The loss functions shown in Equations (5), (7), (8) and (11) use the margin-based ranking criterion to learn embeddings. The goal of the learning process is to score positive triples lower than the negative triples. However, the aforementioned loss functions make it impossible for positive triples to obtain absolutely low scores, resulting in drifts during the mapping of entity embeddings to the unified vector space. To address this problem, we propose the limit-based loss function. Modifying the loss function in Equation (5) to the limit-based criterion, we obtain:  
\[L_{SE-direct}=\sum_{(h,r,t)\in T_{R}}\Bigl{[}\left\|\mathbf{h}+\mathbf{r}-\mathbf{t} \right\|_{L_{2}}-\gamma_{1}\Bigr{]}_{+}+\mu\sum_{(h^{\prime},r^{\prime})\in T ^{\prime}_{R}}\Bigl{[}\gamma_{2}-\left\|\mathbf{h}^{\prime}+\mathbf{r}^{\prime}-\mathbf{t}^ {\prime}\right\|_{L_{2}}\Bigr{]}_{+} \tag{12}\]  
where \(\gamma_{1}\) and \(\gamma_{2}\) are the margin hyperparameters that satisfy \(\gamma_{1}>0\) and \(\gamma_{2}>0\), respectively, and \(\mu\) is the balancing factor. The loss function in Equation (12) ensures that positive triples are scored lower than negative triples and provides absolutely low and high scores to positive and negative triples, i.e., \(\left\|\mathbf{h}+\mathbf{r}-\mathbf{t}\right\|_{L_{2}}\leq\gamma_{1}\) and \(\left\|\mathbf{h}^{\prime}+\mathbf{r}^{\prime}-\mathbf{t}^{\prime}\right\|_{L_{2}}\geq\gamma _{2}\), respectively.  
The modified versions of the loss functions in Equations (7), (8) and (11) are shown in Equations (13), (14) and (16), respectively.  
\[L_{SE-direct}=\sum_{(h,r,t)\in T_{R}}\bigl{[}\left\|\mathbf{h}\mathbf{M}_{r}+\mathbf{r}-\mathbf{ t}\mathbf{M}_{r}\right\|_{L_{2}}-\gamma_{1}\bigr{]}_{+}+\mu\sum_{(h^{\prime},r^{ \prime})\in T_{R}}\bigl{[}\gamma_{2}-\left\|\mathbf{h}^{\prime}\mathbf{M}_{r}+\mathbf{r}^{ \prime}-\mathbf{t}^{\prime}\mathbf{M}_{r}\right\|_{L_{2}}\bigr{]}_{+} \tag{13}\]\[L_{SE-multistep}=\sum\limits_{(h,r,t)\in T_{R}}\left\{\frac{1}{2}\sum \limits_{p\in P(h,t)}R(p|h,t)\left[\left\|\mathbf{p}-\mathbf{r}\right\|_{L_{2}}-\gamma_{ 1}\right\}_{+}\right\} \tag{14}\] \[+\mu\sum\limits_{(h,r,t)\in T_{R}}\left\{\frac{1}{2}\sum\limits_{ p\in P(h,t)}R(p|h,t)\left[\gamma_{2}-\left\|\mathbf{p}-\mathbf{r}^{\prime}\right\|_{L_{2}} \right]_{+}\right\}\]  
\[L_{SE}=L_{SE-direct}+L_{SE-multistep} \tag{15}\]  
\[L_{CE}=\sum\limits_{(e,\mathbf{\omega},e)\in T_{A}}\left[\left\|\mathbf{e}+\mathbf{a}-f_{a }(\mathbf{v})\right\|_{L_{2}}-\gamma_{1}\right]_{+}+\mu\sum\limits_{(e^{\prime}, \mathbf{a}^{\prime},\mathbf{v}^{\prime})\in T_{A}}\left[\gamma_{2}-\left\|\mathbf{e}^{ \prime}+\mathbf{a}^{\prime}-f_{a}(\mathbf{v}^{\prime})\right\|_{L_{2}}\right]_{+} \tag{16}\]  
The learning of structural embeddings and attribute character embeddings yields \(e_{SE}\) and \(e_{CE}\), which are the structural embeddings and attribute character embeddings of the entities in \(KG_{1}\) and \(KG_{2}\), respectively. In general, \(e_{SE}\) tends to fall in different vector spaces, considering the entities in \(KG_{1}\) and \(KG_{2}\) are usually named using different naming schemes. In contrast, the vector representations of the attribute values in \(KG_{1}\) and \(KG_{2}\) always fall into the same vector space, considering the character embeddings are learned from attribute value strings. Consequently, \(e_{CE}\) falls into a unified vector space. Therefore, the learned attribute character embeddings can be used to transfer the structural embeddings of entities into a unified vector space. The joint learning of structural embeddings and attribute character embeddings was performed by minimizing \(L_{SIM}\) (Equation (17)).  
\[L_{SIM}=\sum\limits_{e\in KG_{1}\cup KG_{2}}\left[1-\frac{\mathbf{e}_{SE}\cdot\mathbf{e }_{CE}}{\left\|\mathbf{e}_{SE}\right\|\left\|\mathbf{e}_{CE}\right\|}\right] \tag{17}\]  
Finally, Equations (15)-(17) are combined to obtain the overall training loss function \(L\) (Equation (18)).  
\[L=L_{SE}+L_{CE}+L_{SIM} \tag{18}\]