## 2 Related Work
### Detailed Structure of SE-GNNRM
#### 3.2.1 Item Embedding Layer  
The input to the model is the preprocessed sequence of sessions, and a directed graph of all session sequences is constructed. The item embedding layer contains two modules, a graph neural network (GNN) module and a self-attention (SAN). The directed graph of the session sequence is input into the GNN module, and then the item embedding is learned by using the powerful embedding learning ability of GNN for graph structure nodes. The session sequence is input into the SAN module, and the SAN learns the correlation between the session sequences through the self-attention mechanism in order to obtain a more representative embedding of the item. GNN generates node embeddings on topological graphs to model the dependencies of item feature transformations, and GNN is suitable for session-based recommendations. Each session sequence \(S\) preprocessed is modeled as a directed graph \(G_{s}=(V_{s},E_{s})\) as the input to the GNN module, where each node represents an item \(v_{s,i}\in V_{s}\), and each connection in the directed graph represents connections between items in a session. Representing each item into a unified space, the resulting vector \(v_{i}\in R^{d}\) is the \(d\)-dimensional embedding of \(v_{i}\) obtained using GNN. Based on the idea of RNN, [PERSON] et al. [36] introduce the GRU unit into GNN and propose a variant gated graph neural network (GGNN) to make it more suitable for processing sequence data. This model uses GGNN to extract node features. The updated propagation formula for node \(v_{s,i}\) in session \(S\) is described as follows. \[a_{s,i}^{(t)}=A_{s,i}[v_{1}^{(t-1)},\ldots,v_{n}^{(t-1)}]^{\mathsf{T}}W_{H}+b_ {1} \tag{1}\]  
\[z_{s,i}^{(t)}=\sigma\Big{(}W_{z}a_{s,i}^{(t)}+U_{Z}v_{i}^{(t-1)}+b_{2}\Big{)} \tag{2}\]  
\[r_{s,i}^{(t)}=\sigma\Big{(}W_{r}a_{s,1}^{(t)}+U_{r}v_{i}^{(t-1)}+b_{3}\Big{)} \tag{3}\]  
\[\widetilde{v}_{i}^{(t)}=\tanh\Big{(}W_{o}a_{s,i}^{(t)}+U_{o}(r_{s,i}^{(t)} \odot v_{i}^{(t-1)})\Big{)} \tag{4}\]  
Figure 1: The detailed structure of SE-GNNRM. \[v_{i}^{(t)}=(1-z_{s,i}^{(t)})\odot v_{i}^{(t-1)}+z_{s,i}^{(t)}\odot\widehat{v}_{i}^ {(t)} \tag{5}\]  
where \(W_{H}\in R^{d\times 2d},W_{z},U_{Z},W_{r},U_{r}\in R^{d\times 3d},W_{o},U_{o}\in R ^{d\times d}\) are the learnable weight matrices. \(b_{1}\in R^{d}\) and \(b_{2},b_{3}\in R^{3d}\) are the bias vectors, and \(z_{s,i}^{(t)}\) and \(r_{s,i}^{(t)}\) are reset and update gates, respectively. The reset gate determines how to combine the new input information with the previous information. The update gate defines what the previous information is saved to the current time step. \([v_{1}^{(t-1)},\ldots v_{n}^{(t-1)}]\) is the node vector embedding in session s, \(\sigma(\cdot)\) is a sigmoid function, and \(\odot\) is element-wise multiplication. \(A_{s}\in R^{n\times 2n}\) is defined as the concatenation of two adjacent order matrices, \(A_{s}^{(out)}\) and \(A_{s}^{(in)}\), representing the weighted connection of incoming and outgoing edges of the session graph. The adjacency matrices \(A_{s}\) distinguish the types of edges in the directed graph and defines how the nodes in the directed graph are connected to each other through incoming and outgoing edges. \(A_{s,i}\in R^{1\times 2n}\) is the i-th row in \(A_{s}\), which is the part corresponding to the node \(v_{s,i}\). In addition, since duplicate items may appear in the session sequence, a normalized assignment is calculated for each edge, the initial value of the edge divided by the number of incoming or outgoing edges of the node. Self-attention (SAN) is an attention mechanism that computes sequence embeddings related to different positions of a single sequence and has been successfully applied in many fields. The self-attention mechanism reduces the dependence on external information and is better at capturing the internal correlation of features.