# Discretly Exploiting Inter-Session Information for Session-Based Recommendation
## 4 Methodology
### Intra-Session Module  
Intra-session information processing is an essential component of SBR, as it encompasses all aspects of a user's interactions and is closely linked to the user's ultimate choice. We also divide intra-session information into \(\mathcal{K}\) factor-level sub-channels to process, in order to examine the user's preferences for each factor because the user's preference for an item is often based on one or more factors. This method is somewhat related to the theory of our proposed metric stability in the inter-session module. Intuitively, each interacted item has impacts on the session embedding in various factors. The input here includes the set consisting of factor-level embeddings of all items in \(s\), i.e., \(\left\{\mathcal{F}_{s}^{(f,1)},...,\mathcal{F}_{s}^{(f,K)}\right\}\). Similar to inter-session dependencies, items within a session may have varying dependencies on different factors. Therefore, we handle the original item-level intra-session graph \(\mathcal{G}_{s}^{l}\) in a similar manner as the previous item-level inter-session graph. Specifically, we replace the weights of the edges with the similarity scores on each factor, resulting in the formation of \(\mathcal{K}\) factor-level intra-session graphs \(\left\{\mathcal{G}_{s}^{(l,1)},...,\mathcal{G}_{s}^{(l,K)}\right\}\). In each factor-level sub-channel, we use the most commonly used Graph Gated Neural Network (GGNN) [12] method to update the item-level embedding. As an example, we define the operation in the \(k\)-th sub-channel as the following Equations (11)-(15):  
\[\mathbf{c}_{(s,i)}^{(f,k)^{l}}=\text{Concat}(\mathbf{W}_{in}^{(f,k)}\mathbf{ \mathcal{A}}_{(s,in)}^{(l)}([\mathbf{x}_{(s,1)}^{(f,k)^{l}},...,\mathbf{x}_{(s,n)}^{( f,k)^{l}}]^{\top})+\mathbf{b}_{in}^{(f,k)}, \tag{11}\] \[\mathbf{W}_{out}^{(f,k)}\mathcal{A}_{(s,out)^{(l)}}^{(l)}([\mathbf{x}_{(s,1)}^{(f,k)^{l}},...,\mathbf{x}_{(s,n)}^{(f,k)^{l}}]^{\top})+\mathbf{b}_{out}^{(f,k)}),\]  
\[\mathbf{z}_{(s,i)}^{(f,k)^{l}}=\sigma(\mathbf{W}_{z}^{(f,k)}\mathbf{c}_{(s,i)}^{(f,k)^{l}}+ \mathbf{U}_{z}^{(f,k)}\mathbf{x}_{(s,i)}^{(f,k)^{l-1}}), \tag{12}\]  
\[\mathbf{r}_{(s,i)}^{(f,k)^{l}}=\sigma(\mathbf{W}_{r}^{(f,k)}\mathbf{c}_{(s,i)}^{(f,k)^{l}}+ \mathbf{U}_{r}^{(f,k)}\mathbf{x}_{(s,i)}^{(f,k)^{l-1}}), \tag{13}\]  
\[\mathbf{\tilde{x}}_{(s,i)}^{(f,k)^{l}}=\text{tanh}(\mathbf{W}_{h}^{(f,k)}\mathbf{c}_{(s,i) }^{(f,k)^{l}}+\mathbf{U}_{h}^{(f,k)}(\mathbf{r}_{(s,i)}^{(f,k)^{l}}\odot\mathbf{x}_{(s,i)} ^{(f,k)^{l-1}})), \tag{14}\]  
\[\mathbf{x}_{(s,i)}^{(f,k)^{l}}=(1-\mathbf{z}_{(s,i)}^{(f,k)^{l}})\odot\mathbf{x}_{(s,i)}^{( f,k)^{l-1}}+\mathbf{z}_{(s,i)}^{(f,k)^{l}}\odot\mathbf{\tilde{x}}_{(s,i)}^{(f,k)^{l}}, \tag{15}\]  
where \(\mathbf{c}_{(s,i)}^{(f,k)^{l}}\) is the information that \(\mathbf{v}_{(s,i)}\) can learn from its adjacent nodes in the \(I\)-th layer, \(\mathcal{A}_{(s,in)}^{(l,k)}\) and \(\mathcal{A}_{(s,out)}^{(l,k)}\) are the in-degree and out-degree matrices corresponding to the adjacency matrix \(\mathcal{A}_{s}^{(l,k)}\) of \(\mathcal{G}_{s}^{(l,k)}\). \(\mathbf{x}_{(s,i)}^{(f,k)^{l}}\) represents the factor-level embedding of node \(\mathbf{v}_{(s,i)}\) on factor \(\mathbf{k}\) at layer \(\mathbf{I}\) and \(\mathbf{x}_{(s,i)}^{(f,k)^{0}}=\mathbf{e}_{(s,i)}^{(f,k)}\). \(\mathbf{z}_{(s,i)}^{(f,k)^{l}}\) and \(\mathbf{r}_{(s,i)}^{(f,k)^{l}}\) are respectively the update gate and reset gate in the gating mechanism. \(\mathbf{\sigma}\) and \(\mathbf{\tanh}\) are activation functions. Note that \(\mathbf{W}_{in}^{(f,k)}\), \(\mathbf{W}_{out}^{(f,k)}\), \(\mathbf{W}_{z}^{(f,k)}\), \(\mathbf{W}_{h}^{(f,k)}\), \(\mathbf{U}_{z}^{(f,k)}\), \(\mathbf{U}_{t}^{(f,k)}\), and \(\mathbf{U}_{h}^{(f,k)}\in\mathbb{R}^{d_{f}\times d_{f}}\) are all learnable weights and \(\mathbf{b}_{in}^{(f,k)}\) and \(\mathbf{b}_{out}^{(f,k)}\in\mathbb{R}_{f}^{d}\) are biases. The final layer's output is \(\left\{\overline{\mathbf{e}}_{(s_{1})}^{(f,k)},\cdots,\overline{\mathbf{e}}_{(s_{n})}^{( f,k)}\right\}\).