# Temporal Enhancement of Top-N Recommendation on Heterogeneous Graphs
## 4 The Proposed Model  
### Overall Framework  
In this study, we propose a recommender system called TMRec for the determination of the temporal relation of each sequence to enhance the embeddings. The proposed model can be divided into three parts: user embedding representation learning, item embedding representation learning, and meta-path embedding learning. Firstly, LSTM can remember important information and forget irrelevant details by controlling the flow of information. Moreover, RSA, which includes multiple sandwich networks and gated self-attention networks, can dynamically focus on the most important parts of information. Therefore, we adopt LSTM and RSA to process users and items, respectively, as they can effectively capture the heterogeneous and temporal relations among users and items. Secondly, DPSA has better learning ability for different nodes in meta-paths on account of its deep convolutional neural networks with different convolutional kernels and a residual network within the self-attention mechanism; therefore, we use it with max pooling and L2-normalization to process the meta-paths for determining the heterogeneous and temporal relations among users.  
\begin{table}
\begin{tabular}{c c} \hline
**Notation** & **Description** \\ \hline \(\mathbf{m}_{u}\) & User’s embedding after lookup layer \\ \hline \(\mathbf{n}_{i}\) & Item’s embedding after lookup layer \\ \hline \(\mathbf{x}_{u}\) & Low-dimensional representations of users \\ \hline \(\mathbf{y}_{i}\) & Low-dimensional representations of items \\ \hline \(\mathbf{x}_{u}{}^{\prime}\) & Improved user’s embedding after LSTM module \\ \hline \(\mathbf{\tilde{x}}_{u}\) & Final user’s embedding after self-attention mechanism \\ \hline \(\mathbf{\tilde{y}}_{i}\) & Final item’s embedding after self-attention mechanism \\ \hline \(\mathbf{h}_{p}\) & Embedding of path instance p \\ \hline \(\mathbf{c}_{p}\) & Initial embedding of meta-path \\ \hline \(\mathbf{c}_{p}{}^{\prime}\) & Embedding of meta-path after L2-normalization \\ \hline \(\mathbf{c}_{u,i}\) & Final embedding of meta-path after co-attention mechanism module \\ \hline \(\mathbf{r}_{u,i}\) & Embedding of final fusion \\ \hline \end{tabular}
\end{table}
Table 1: Notations and their descriptions.  
Figure 1: An instance of an HIN for top-N recommendation.  
relations among nodes of different types in the data to improve the representations. Thirdly, collaborative attention is used for enhancing the ability to obtain the interactions of users, items, and meta-paths. The overall framework of the proposed TMRec is described in Figure 2.  
Specifically, we acquire the embeddings of users, items, and meta-paths and combine them as the final embedding to perform a recommendation task. It is worth mentioning that the embeddings of the users and items are generated in the same way, and we take user embeddings as an example to describe the framework. After a lookup layer is employed to obtain low-dimensional and dense vectors, we utilize the LSTM module to process the data and the RSA module to determine the importance of each node and learn more meaningful embeddings. As for the meta-path embeddings, we use priority scores to generate high-quality path instances and aggregate them into a meta-path embedding with the DPSA module to improve the representation. In addition, we use L2-normalization to process the embedding of a single meta-path to avoid overfitting. Then, the final meta-path embedding is obtained with a co-attention mechanism in the case where user and item embeddings are used as input. Finally, we concatenate the above three embeddings into a representation for top-N recommendations.