# News Recommendation Method Based on Candidate-Aware Long- and Short-Term Preference Modeling
## 3 Method
### Long-Term User Preference Encoder
#### 3.2.2 Candidate-Enhanced Graph Attention Networks  
**Enhance click news representation based on click news-candidate news graph. ** We assume that the user \(u\) clicks on news \(i\). For news node \(i\) and its corresponding set of candidate news nodes \(N_{i}^{S}=\left[n_{i}^{1},n_{i}^{2},\ldots,n_{i}^{S}\right]\), we first learn their corresponding feature representations \(\mathbf{\hat{h}_{i}}\) and \(\mathbf{h_{i}^{S}}\), respectively, via the news encoder. GATs are applied to fully exploit the relationship between clicked news and candidate news. We take click news node embedding \(\mathbf{\hat{h}_{i}^{(1-1)}}\) and its k-th candidate news embedding \(\mathbf{h_{i,k}^{(1-1)}}\) as inputs to obtain the clicked news node embedding in \((l-1)\)-layer through GATs. First of all, it is necessary to distinguish the different informativeness \(\epsilon_{i,s}\) of different candidate news for clicking the news node \(i\),  
\[e_{i,s}=\frac{1}{\sqrt{d}}\Big{(}\mathbf{W_{1}^{(1-1)}}\mathbf{\hat{h}_{i}^{(1 -1)}}\Big{)}^{T}\Big{(}\mathbf{W_{2}^{(1-1)}}\mathbf{h_{i,k}^{(1-1)}}+\mathbf{ b_{i}^{(1-1)}}\Big{)} \tag{8}\]  
where \(\mathbf{W_{1}^{(1-1)}}\), \(\mathbf{W_{2}^{(1-1)}}\) and \(\mathbf{b_{i}^{(1-1)}}\) are trainable parameter matrices in \((l-1)\)-layer. \(d\) denotes the dimension of the node embeddings. The score \(\alpha_{i,s}\) of click news node \(i\) for its neighbor nodes can be obtained by the following equation:  
\[\alpha_{i,s}=\text{softmax}(e_{i,s}) \tag{9}\]  
Finally, the representation \(\mathbf{h_{i}^{(1-1)}}\) of the clicked news node \(i\) in \((l-1)\)-layer is obtained by aggregating information from all its neighbors (candidate news nodes):  
\[\mathbf{h_{n,i}^{(1-1)}}=\sum_{s\in S}\alpha_{i,s}\mathbf{h_{i,s}^{(1-1)}} \tag{10}\]  
\[\mathbf{h_{i}^{(1-1)}}=\text{FFN}\Big{(}\Big{[}\mathbf{\hat{h}_{i}^{(1-1)}}; \mathbf{h_{n,i}^{(1-1)}}\Big{]}\Big{)} \tag{11}\]  
where \(\text{FNN}(\cdot)\) is a simple feed-forward neural network. The enhanced click-through news embedding for user \(u\) is denoted as \(\mathbf{h_{u,n}^{(1-1)}}\). **Update user representation based on user-click news heterogeneous graph. ** For the user \(u\), given his reading history \([n_{1},n_{2},\ldots,n_{M}]\), we obtain the history news embedding by the news encoder firstly. For the user \(u\), the news has browsed usually has different levels of importance. Based on this, we take the user node embedding \(\mathbf{\hat{h}_{u}^{(1-1)}}\) and click news embedding \(\mathbf{\hat{h}_{u,n}^{(1-1)}}\) as inputs in \((l-1)\)-layer, differentiate the different information amount \(e_{u,i}\) of different click news to the user,  
\[e_{u,i}=\frac{1}{\sqrt{d}}\Big{(}\mathbf{W_{3}^{(1-1)}}\mathbf{\hat{h}_{u}^{(1 -1)}}\Big{)}^{T}\Big{(}\mathbf{W_{4}^{(1-1)}}\mathbf{\hat{h}_{u,n,i}^{(1-1)}}+ \mathbf{b_{u}^{(1-1)}}\Big{)} \tag{12}\]  
where \(\mathbf{W_{3}^{(1-1)}}\), \(\mathbf{W_{4}^{(1-1)}}\) and \(\mathbf{b_{u}^{(1-1)}}\) are trainable parameter matrices in \((l-1)\)-layer. Based on this, the user score \(\alpha_{u,i}\) for clicked news can be obtained,  
\[\alpha_{u,i}=\text{softmax}(e_{u,i}) \tag{13}\]By aggregating information from all its neighbors, a representation \(\mathbf{h}_{\mathbf{u}}^{(\mathbf{l}-1)}\) of user node \(u\) at \((l-1)\)-layer can be obtained,  
\[\mathbf{\hat{h}}_{\mathbf{u},\mathbf{n}}^{(\mathbf{l}-1)}=\sum_{j\in M}\alpha_{ u,j}\mathbf{\hat{h}}_{\mathbf{u},\mathbf{n},\mathbf{j}}^{(\mathbf{l}-1)} \tag{14}\]  
\[\mathbf{h}_{\mathbf{u}}^{(\mathbf{l}-1)}=\text{FFN}\Big{(}\Big{[}\mathbf{ \hat{h}}_{\mathbf{u}}^{(\mathbf{l}-1)};\mathbf{\hat{h}}_{\mathbf{u},\mathbf{n }}^{(\mathbf{l}-1)}\Big{]}\Big{)} \tag{15}\]  
We obtain the representation \(\mathbf{h}_{\mathbf{u}}^{(\mathbf{l}-1)}\) of user node \(u\) and his/her click news embedding \(\mathbf{h}_{\mathbf{u},\mathbf{n}}^{(\mathbf{l}-1)}\) at \((l-1)\)-layer from the above operations.