## 3 Materials and Methods
### Skip-Gram Layer  
The skip-gram module, which is a novel component, is designed to capture sequential relationships between items within a user session in SBR tasks. It leverages the skip-gram model's core principle to learn informative representations of items based on their co-occurrence patterns within a session. The skip-gram module takes a sequence of items representing a user's session as input. This sequence can be padded or truncated to a fixed length if necessary. During training, a target item within the session is the last item or purchase item chosen. This target item represents the item the model aims to predict the user's interest in, given the context of surrounding items. In skip-gram, the context window size is set to five. This window captures a fixed number of items before and after the target item, representing the user's recent browsing history within the related session. Each item in the session sequence is mapped to its corresponding dense embedding vector  
Figure 1: Overview of the proposed SkipGT Model.  
using an embedding lookup table. These embedding vectors represent the items in a low-dimensional space, capturing their inherent properties and relationships. The skip-gram layer then computes the dot product between the embedding vector of the target item and the embedding vectors of items within the context window. Intuitively, items with similar contexts will have higher dot product values, indicating a stronger relationship. A loss function, negative log-likelihood, is used to measure the discrepancy between the predicted probabilities and the actual occurrence of items in the context window. Backpropagation is employed to propagate the loss signal and update the embedding lookup table, effectively adjusting the embedding vectors of items based on their co-occurrence patterns within sessions. The numerical values depicted in the diagram signify the weight matrices, which modulate the successive transformations applied to the input data to generate the output. The training process for this network involves optimizing these weight matrices' values, enabling the output to closely approximate the training data. Upon completion of the training phase, the output layer is typically discarded, while the hidden layer, referred to as the embeddings, is utilized for subsequent processes. These embeddings (d = 128) are vector representations of each item, where items exhibiting similarities are encoded as vectors positioned in close proximity within the embedding space. Item embedding vectors are then given to the transformer's input embedding and output embedding. The probabilities of skip-gram for items are calculated as in Equation (1):  
\[\text{P}\big{(}item_{c,j}=item_{O,c}|item_{I}\big{)}=\frac{\exp u_{c,j}}{\sum _{j^{\prime}=1}^{V}\exp u_{c,j^{\prime}}} \tag{1}\]  
\(item(c,j)\) is the \(j\)th item predicted on the \(c\)th context position; \(item(O,c)\) is the actual item present on the \(c\)th context position; \(item(I)\) is the only input item; and \(u(c,j)\) is the \(j\)th value in the \(u\) vector when predicting the item for \(c\)th context position. It is calculated with the loss function Equation (2), which is used in the training of the skip-gram model.  
\[\mathcal{L}=- \log\mathbb{P}(item_{c,1},item_{c,2},\dots,item_{c,C}|item_{o}) \tag{2}\] \[=-\log\prod_{c=1}^{C}\mathbb{P}(item_{c,j}|item_{o})\] (3) \[=-\log\prod_{c=1}^{C}\frac{\exp\big{(}u_{c,j^{\prime}}\big{)}}{ \sum_{j=1}^{V}\exp\big{(}u_{c,j}\big{)}}\] (4) \[=-\sum_{c=1}^{C}u_{c,j^{\prime}}+\sum_{c=1}^{C}\log\sum_{j=1}^{V} \exp\big{(}u_{c,j}\big{)} \tag{5}\]  
As we want to maximize the probability of predicting \(item(c,j)\) on the \(c\)th context position, we can represent the loss function \(L\).