# Knowledge Graph Double Interaction Graph Neural Network for Recommendation Algorithm
## 4 Methodology
### Knowledge Graph Convolution Neural Network
#### 4.1.2 Neighbor Entity Aggregation  
In the KGDI model, if the relationship vector \(r_{i}\) in Figure 1 is used directly as the weight of message passing, the vector needs to be converted into a value to calculate during the calculation, which increases the difficulty of calculation. Therefore, the relation vector is converted into a weight \(w\) in some way, and the weight denotes the degree of preference of  
Figure 3: KGDI model framework. \(\otimes\) denotes the element-wise inner product, \(\oplus\) denotes the element-wise summation, denotes the element-wise concatenation, and \(\odot\) denotes the aggregation operation. different relationships influencing user behavior. For example, some users may pay more attention to movies with the same'star', while some users pay more attention to movies with the same 'genre'. With this relation weight, users' personalized preferences can be quantified. \(r_{e_{i},e_{j}}\) denotes the relation between entity \(e_{i}\) and \(e_{j}\). Define the scoring function \(g_{u}(r)\) to calculate the score between a user and a relation:  
\[w_{r}^{u}=g(u,r), \tag{4}\]  
where \(u\) and \(r\) are the feature vectors of users and relations, respectively. Because the user vector is added to every message passing, the result naturally reflects the attention of user \(u\) better than taking the relation vector \(r\) directly. \(S(\cdot)\) is an inner product function that measures the user's preference for different relationships. Normalize the user-relation score \(w_{r}^{u}\):  
\[\widetilde{w}_{r_{\
u,e_{i}}}^{u}=soft\;max(w_{r_{\
u,e_{i}}}^{u})=\frac{exp(w_ {r_{\
u,e_{i}}}^{u})}{\sum_{e\in S(v)}exp(w_{r_{\
u,e_{i}}}^{u})}. \tag{5}\]  
Use the scoring function \(g_{v}(e)\) to calculate the influence weights of different neighbor nodes \(e\) on the central entity \(v\):  
\[w_{e}^{v}=g(v,e). \tag{6}\]  
Normalize the influence weights of neighbor entities on the central entity:  
\[\widetilde{w}_{e}^{v}=soft\;max(w_{e}^{v})=\frac{exp(w_{e}^{v})}{\sum_{e\in S (v)}exp(w_{e}^{v})}. \tag{7}\]  
The embedding representation of entity is updated through the message-passing mechanism, which is mainly divided into two stages: message aggregation and message update. The iterative process of neighbor nodes feature integration is shown in Figure 4. The nodes of each layer are generated by the previous layer. In this way, the nodes of the first layer aggregate the information of the second layer. After the two-layer aggregation is completed, it can be extended to the node in layer 0, which contains all the information of the neighbors of the two layers. Figure 4: Iterative process of feature fusion of neighbor nodes. A central node \(v\) has more than one neighbor, so the message aggregation function is used to aggregate the messages delivered by all neighbor nodes of node \(v\). Define the aggregate function as follows:  
\[v^{u}_{S(v)}=\sum_{e\in S(v)}\widetilde{w}^{u}_{v_{u}}e+\widetilde{w}^{v}_{e}e, \tag{8}\]  
where \(e\) is the feature of the neighbor node of entity \(v\). \(v^{u}_{S(v)}\) is not obtained directly by summing up the embedding vectors of \(e\), but by applying different weights to \(e\) and the weighted summation operation is performed between the weights and \(e\). The use of weights here reflects the idea of attention mechanism. In this way, the importance of each path is different according to the preference degree of different users when traversing the knowledge graph. Message update  
Unlike KGCN, the presented algorithm interacts the integrated user feature \(u^{v}\) with the entity \(v\) and the mixed vector \(v^{u}_{S(v)}\) of the neighbor set, respectively, rather than directly integrating. This not only can effectively use the integrated item features in \(u^{v}\) for one-to-one correspondence matching, but also takes into account the neighbor information.