This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Making Recommender Systems More Knowledgeable: A Framework to Incorporate Side Information

Yukun Jiang
Language Technologies Institute
Carnegie Mellon University
Pittsburgh, PA 15213
[email protected]
&Leo Guo
Language Technologies Institute
Carnegie Mellon University
Pittsburgh, PA 15213
[email protected]
&Xinyi Chen
Language Technologies Institute
Carnegie Mellon University
Pittsburgh, PA 15213
[email protected]
&Jing Xi Liu
Language Technologies Institute
Carnegie Mellon University
Pittsburgh, PA 15213
[email protected]
Abstract

Session-based recommender systems typically focus on using only the triplet (user_id,timestamp,item_id)(user\_id,timestamp,item\_id) to make predictions of users’ next actions. In this paper, we aim to utilize side information to help recommender systems catch patterns and signals otherwise undetectable. Specifically, we propose a general framework for incorporating item-specific side information into the recommender system to enhance its performance without much modification on the original model architecture. Experimental results on several models and datasets prove that with side information, our recommender system outperforms state-of-the-art models by a considerable margin and converges much faster. Additionally, we propose a new type of loss to regularize the attention mechanism used by recommender systems and evaluate its influence on model performance. Furthermore, through analysis, we put forward a few insights on potential further improvements.

1 Introduction

The recommender system (RS) has been one of the most successful and profitable AI applications in today’s business. Due to the rapidly increasing flow of information online, companies are capable of making timely and suitable recommendations to their customers, in eager hope of facilitating the deal.

However, training an accurate recommender system is not an easy task. Literature often finds that, for various reasons, traditional statistical machine learning models like K-Nearest Neighbor (KNN) could outperform deep learning-based models, even if the latter is dominating other fields like computer vision and natural language processing. Some conjecture that it is because people do not fully utilize side information when building the model. In this project, we aim to explore a deep neural network approach to incorporate side information into recommender systems to make them more knowledgeable.

Current methods such as MK-MSR proposed by Meng et al. (2020) use item attributes, or item knowledge, to obtain side information for modeling the transition pattern between related segments. However, they did not provide any generic approach that could apply to different recommender tasks. This paper aims to establish a general framework that can be adopted by existing models to improve model performance. Experimental results on several models and datasets prove that with side information, our recommender system outperforms state-of-the-art models by a considerable margin and converges much faster. Additionally, we propose a new type of loss to regularize the attention mechanism used by recommender systems and evaluate its influence on models’ performance.

The main contributions of this paper can be summarized as the following:

  1. 1.

    Demonstrate the effectiveness and usefulness of side information in the context of session-based recommender system

  2. 2.

    Provide a general framework for incorporating side information into common existing session-based recommender systems

  3. 3.

    Exemplify how model performance can be further improved without too much modification on its architecture

2 Related works

Traditional recommender systems such as content-based RS and collaborative filtering-based RS often integrate the entire user history to understand each user’s long-term interests in entities. Newer models using the idea of session-based RS with time-sensitive contexts bring more attention to users’ short-term preferences. Wang et al. (2021) provided a comprehensive overview of the history and state-of-the-art approaches in session-based recommender systems (SBRS). They distinguished current challenges of SBRS, including recognizing arbitrary interactions within timely sessions, as well as effectively understanding the cascaded long-term sequential correlations that diminish progressively through time. This paper also elucidates inter-session dependencies that span long-range sessions.

For session-based systems, there has been an abundance of novel attempts in neural network based design. Ren et al. (2019) introduced a new neural recommendation architecture called RepeatNet, which exploits the fact that in many scenarios, an item is repeatedly consumed by a user over time. They made the neural network aware of such repeated consumption by a “repeat-or-explore” mechanism built upon a regular recurrent neural network (RNN) recommender system.

Another example is the session-based recommendation with graph neural networks (SR-GNN) proposed by Wu et al. (2019). SR-GNN aims to generate precise item embeddings while taking complex transitions of items into account, where sessions will be modeled as graph structures and items will be modeled as nodes, allowing automatic extraction of features with respect to node connections. SR-GNN presents another method for combining the short-term interests and long-term preferences of users. The model does not assume any distinct latent representation of users, instead, it uses embedding of items in each session to compute short-term and long-term session interests. To combat the inconsistent information priority for each session, a soft-attention mechanism is used to prioritize different interests when calculating the embedding vector representing long-term interest of the session. It then uses session embedding containing long-term interest and short-term interest to generate recommendations.

Side information has also been explored in previous research. In the paper of Meng et al. (2020), they made attempts to utilize side information as users’ operation, such as reading the comments and adding items to the cart. They incorporated this item knowledge into a multi-task learning paradigm, jointly modeling items and users’ micro-behaviors. They defined each micro-behavior as a combination of items and their corresponding operation. By constructing the embedding for both users’ and items’ side information, their recommender system achieved a remarkable performance boost.

3 Dataset

Our experiments are based on four main datasets: an e-commerce transaction dataset Diginetica, a user-based music history dataset Last.FM, a movie rating dataset MovieLens, and a grocery store transaction dataset Ta Feng.

3.1 Dataset preprocessing

We apply the following preprocessing steps on each of the datasets to generate train and test sets for further experiments. The specific choice of values are mentioned in Section 3.2.

  • 1.

    We choose the training target, e.g. item ID, of which we analyze the patterns and make predictions. We also select the side information, e.g. category or subclass ID, which we utilize to improve our model performance.

  • 2.

    We split data into user-based sessions. The session length varies for different datasets. If the dataset is tested in our baseline models, we follow the same choice of session length. Data within a session spans less than a set duration, e.g. 8 hours or 2 weeks, which varies in different datasets. In addition, we filter out sessions with lengths smaller than 2. We further split sessions if they are longer than the session length.

  • 3.

    We shuffle the dataset and split the session dataset into train and test sets.

  • 4.

    For a session like [x1,x2,x3,,xn][x_{1},x_{2},x_{3},\dots,x_{n}], we generate it into n1n-1 lines of data, having [x1,x2,,xi,0,0,,0][x_{1},x_{2},\dots,x_{i},0,0,\dots,0] being the input and [xi+1][x_{i+1}] being the target output, for i{1,,n1}i\in\{1,\dots,n-1\}. The length of each input is the predefined session length, and we pad zeros after the ii-th item. That is to say, the data are generated in the way that given the preceding information within a session, we aim to predict the next item in that session.

  • 5.

    To utilize the side information, we create a mapping of item ID to its side information, e.g. category ID. For each line of the train/test data, we substitute the original item ID into its side information, e.g. category ID, to obtain a complementary dataset.

3.2 Dataset description

Diginetica111https://competitions.codalab.org/competitions/11161#learn_the_details-data2 This dataset contains user session data extracted from an e-commerce search engine logs that can be used to build session-based recommender systems. We use the same script as that of RepeatNet to preprocess Diginetica in order to replicate the baseline results. In addition to the preprocessing steps mentioned above, we also filter out items that appear less than 5 times. Ren et al. (2019) evaluated RepeatNet’s performance on this dataset. However, the RepeatNet model only used basic information like timestamp and product ID to make predictions. We incorporate side information like the category of the product to improve the performance of RepeatNet.

Last.FM222http://ocelma.net/MusicRecommendationDataset/lastfm-360K.html This dataset contains <user, timestamp, artist, song> tuples collected from Last.FM API, which represents the whole listening habits of nearly 1,000 users. For the preprocessing, we select artist ID as the training target and set the session length to be 50, while the session duration is 8 hours. Ren et al. (2019) evaluated RepeatNet’s performance on this dataset. This dataset is only used for baseline since it does not contain enough side information.

MovieLens333https://grouplens.org/datasets/movielens/ This dataset is a popular movie rating dataset, and the commonly used features are user ID, item ID, timestamp, and rating. For the preprocessing, we select movie ID as the training target and set the session length to be 50, while the session duration is one day. In addition to the preprocessing steps mentioned above, we also filter out items that appear less than 5 times. The MovieLens dataset also contains features like genres of movies, which can be used to train embeddings for movies. We believe such embeddings can be informative and are able to boost the performance of recommender system models.

Ta Feng444https://www.kaggle.com/chiranjivdas09/ta-feng-grocery-dataset This dataset contains transaction data from a Chinese grocery store. Ta Feng includes features such as transaction_date, customer_id, product_id, product_subclass, etc. For the preprocessing, we select product ID as the training target and set the session length to be 40, while the session duration is 2 weeks. For Ta Feng, we use product subclass as side information to improve the performance.

3.3 Side information

The choice of side information is highly relevant to the effectiveness of the extended model. As most recommender system related datasets contain very few extra information other than item ID, timestamp, and user ID, the most common and accessible side information is often tags or subclass information. In this paper, we only experimented with side information being categorical values, and they represent the higher subclass or category of the targets.

4 Baseline selection

We plan to extend the aforementioned deep learning model, the RepeatNet (Ren et al., 2019), and incorporate side information into the current recommender system settings. Therefore, we select RepeatNet as one of our baseline models. We performed modification on the preprocessing part of the original RepeatNet provided by Ren et al. (2019) and run the experiments to replicate the results presented in the paper and compare its performance to our extended model.

In addition to RepeatNet, we also apply the side information framework to the session-based recommendation with graph neural networks (SR-GNN) proposed by Wu et al. (2019) and select SR-GNN as one of our baseline models. The reason is that SR-GNN used Graph Neural Network as encoder, and we want to confirm that our proposed framework works well on various kinds of architecture.

5 Baseline implementation

We run experiments on the four selected datasets using both RepeatNet and SR-GNN.

5.1 RepeatNet

Refer to caption
Figure 1: RepeatNet model. This picture is taken from the RepeatNet paper. j{1,,t},ij\forall j\in\{1,\cdots,t\},i_{j} represents the item at timestamp jj, and hjh_{j} represents the embedding vector of iji_{j} extracted from a GRU that handles items

Among the four datasets, Diginetica and Last.FM are tested by Ren et al. (2019) in the RepeatNet paper. Explanations on the original structure of RepeatNet can be found in Appendix A.1. A detailed model description of the extended RepeatNet is presented in Section 3. We did not simply implement the original RepeatNet architecture. Instead, we modified RepeatNet’s explore mode decoder such that the score of each item is computed from the dot product between the item embedding and the vector representing the entire session. In that way, we will be able to incorporate side information when calculating score for each item in our experiments evaluating the effectiveness of side information. As a starting point, we are able to replicate and verify the result of RepeatNet on Last.FM. This means that our modification doesn’t negatively influence RepeatNet’s behavior. We did not try to replicate the result of RepeatNet on Diginetica, since Ren et al. (2019) used an incorrect method to preprocess Diginetica, as they did not sort items in each session according to timestamp. The result is shown below in Table 1.

Dataset: Last.FM RepeatNet (original) RepeatNet (replicate)
Recall@10 24.18 24.27
Recall@20 32.38 32.41
Mrr@10 11.46 11.80
Mrr@20 12.03 12.36
Table 1: RepeatNet Replication Result

5.2 Session-based Recommendation with Graph Neural Networks (SR-GNN)

Refer to caption

Figure 2: SR-GNN model. This picture is a modification of the original SR-GNN paper. vv’s represent items in a session and hh’s represents the embedding vectors of vv’s extracted from a Graph Neural Network that handles items

Explanations on the original structure of SR-GNN can be found in Appendix A.2. A detailed model description of the extended SR-GNN is presented in Section 4. Diginetica is tested by Wu et al. (2019) in the SR-GNN paper. We are able to replicate the result of SR-GNN on Diginetica, and the result is shown below in Table 2.

Dataset: Diginetica SR-GNN (original) SR-GNN (replicate)
Recall@20 50.73 50.54
MRR@20 17.59 17.48
Table 2: SR-GNN Replication Result

6 Algorithm description

In this section, we propose a method that supports side information incorporation built upon RepeatNet (Ren et al., 2019) and SR-GNN (Wu et al., 2019). A brief summary of the idea and architecture of RepeatNet and SR-GNN is given in Appendix A.1 and A.2. Additionally, we believe that the attention mechanism of existing architectures can be further regularized, so we also propose an additional loss term to regularize the attention.

6.1 General framework to incorporate side information

The basic RepeatNet architecture and SR-GNN architecture do not provide a way to incorporate side information of items in each session, which can be useful and provide additional repeating patterns that may boost the performance of the model, even when the items in each session do not repeat. For example, each movie in the MovieLens dataset has genre information, even though people may not watch a film twice within a period of time, they may tend to focus on movies in the same genre within a fixed period of time.

Thus, given an available session IS={i1,i2,,ij,,it}I_{S}=\{i_{1},i_{2},\cdots,i_{j},\cdots,i_{t}\}, we focus on its corresponding side information SideS={s1,s2,,sj,,st}Side_{S}=\{s_{1},s_{2},\cdots,s_{j},\cdots,s_{t}\} that has the same length as ISI_{S} provided by the dataset, and incorporate such side information into the model. Note that we only consider categorical variables, such as genres of a movie in the MovieLens dataset and the category of the item in the Diginetica dataset when encoding side information.

As mentioned, we propose a general framework to incorporate and encode side information into any existing session-based recommender system that uses a deep neural network architecture. The most straightforward way to achieve our goal is to directly utilize the encoder of any model we want to modify that encodes items in each session. Our method can be expressed as follows:

  1. 1.

    Make a copy of the item encoder that encodes items in each session to encode side information of items in each session.

  2. 2.

    Concatenate the item embedding produced by the item encoder with the corresponding side information embedding produced by the side information encoder. At each timestamp, we will concatenate the item embedding with the side information embedding at the same timestamp.

  3. 3.

    Replace the item embedding with the concatenated embedding in remaining parts of the network.

6.1.1 Side information encoder of RepeatNet

Refer to caption
Figure 3: RepeatNet model with side information. j{1,,t},sj\forall j\in\{1,\cdots,t\},s_{j} represents the side information at timestamp jj, and hjh^{\prime}_{j} represents the embedding vector of sjs_{j} extracted from a separate GRU that handles side information. The model would concatenate hjh_{j} with hjh^{\prime}_{j}, and the concatenated vector would be used by the remaining parts of the model

In RepeatNet, a Gated Recurrent Unit (GRU) is used to encode session ISI_{S} containing items. Specifically, the GRU works as follows:

zri\displaystyle z^{i}_{r} =σ(Wzi[emb(ir),hr1i])\displaystyle=\sigma(W^{i}_{z}[emb(i_{r}),h^{i}_{r-1}]) (1)
rri\displaystyle r^{i}_{r} =σ(Wri[emb(ir),hr1i])\displaystyle=\sigma(W^{i}_{r}[emb(i_{r}),h^{i}_{r-1}]) (2)
hri~\displaystyle\tilde{h^{i}_{r}} =tanh(Whi[emb(ir),rrihr1i])\displaystyle=\tanh(W^{i}_{h}[emb(i_{r}),r^{i}_{r}\odot h^{i}_{r-1}]) (3)
hri\displaystyle h^{i}_{r} =(1zri)hr1i+zrihri~\displaystyle=(1-z^{i}_{r})\odot h^{i}_{r-1}+z^{i}_{r}\odot\tilde{h^{i}_{r}} (4)

where Wzi,Wri,WhiW^{i}_{z},W^{i}_{r},W^{i}_{h}, and emb(ir)emb(i_{r}) are learnable parameters. After this GRU session encoder, a raw available session IS={i1,i2,,it}I_{S}=\{i_{1},i_{2},\cdots,i_{t}\} is encoded into {h1,h2,,ht}\{h_{1},h_{2},\cdots,h_{t}\}.

Same as how RepeatNet encodes each session, we will use a GRU to encode side information SideSSide_{S}. SideSSide_{S} can be either a set of integers or a set of set of integers. If sjSideSs_{j}\in Side_{S} is an integer, then it corresponds to one category of the categorical variable, such as the category of the item; if sjSideSs_{j}\in Side_{S} is a set of integer, then it corresponds to multiple categories of the categorical variable, such as the various genres a movie belong to. We will handle these two cases differently.

Case 1: SideS\textbf{Case 1: }Side_{S} is a set of integers

zrs\displaystyle z^{s}_{r} =σ(Wzs[emb(sr),hr1s])\displaystyle=\sigma(W^{s}_{z}[emb(s_{r}),h^{s}_{r-1}]) (5)
rrs\displaystyle r^{s}_{r} =σ(Wrs[emb(sr),hr1s])\displaystyle=\sigma(W^{s}_{r}[emb(s_{r}),h^{s}_{r-1}]) (6)
hrs~\displaystyle\tilde{h^{s}_{r}} =tanh(Whs[emb(sr),rrshr1s])\displaystyle=\tanh(W^{s}_{h}[emb(s_{r}),r^{s}_{r}\odot h^{s}_{r-1}]) (7)
hrs\displaystyle h^{s}_{r} =(1zrs)hr1s+zrshrs~\displaystyle=(1-z^{s}_{r})\odot h^{s}_{r-1}+z^{s}_{r}\odot\tilde{h^{s}_{r}} (8)

Case 2: SideS\textbf{Case 2: }Side_{S} is a set of set of integers

zrs\displaystyle z^{s}_{r} =σ(Wzs[csremb(c)|sr|,hr1s])\displaystyle=\sigma(W^{s}_{z}[\sum_{c\in s_{r}}\frac{emb(c)}{|s_{r}|},h^{s}_{r-1}]) (9)
rrs\displaystyle r^{s}_{r} =σ(Wrs[csremb(c)|sr|,hr1s])\displaystyle=\sigma(W^{s}_{r}[\sum_{c\in s_{r}}\frac{emb(c)}{|s_{r}|},h^{s}_{r-1}]) (10)
hrs~\displaystyle\tilde{h^{s}_{r}} =tanh(Whs[csremb(c)|sr|,rrshr1s])\displaystyle=\tanh(W^{s}_{h}[\sum_{c\in s_{r}}\frac{emb(c)}{|s_{r}|},r^{s}_{r}\odot h^{s}_{r-1}]) (11)
hrs\displaystyle h^{s}_{r} =(1zrs)hr1s+zrshrs~\displaystyle=(1-z^{s}_{r})\odot h^{s}_{r-1}+z^{s}_{r}\odot\tilde{h^{s}_{r}} (12)

where Wzs,Wrs,Whs,emb(sr)W^{s}_{z},W^{s}_{r},W^{s}_{h},emb(s_{r}) in case 1, and emb(c)emb(c) in case 2 are learnable parameters. After this GRU side information encoder, the raw side information SideS={s1,s2,,st}Side_{S}=\{s_{1},s_{2},\cdots,s_{t}\} is encoded into hs={h1s,h2s,,hts}h^{s}=\{h^{s}_{1},h^{s}_{2},\cdots,h^{s}_{t}\}.

6.1.2 Side information encoder of SR-GNN

Refer to caption

Figure 4: SR-GNN model with side information. ss’s represent the side information in a session and hh^{\prime}’s represents the embedding vectors of ss’s extracted from a Graph Neural Network that handles side information. The model would concatenate hjh_{j} with hjh^{\prime}_{j}, and the concatenated vector would be used by the remaining parts of the model

In SR-GNN, a Graph Neural Network (GNN) is used to encode session ISI_{S} containing items. A detailed description of how GNN works can be found in Appendix A.2. After this GNN item encoder, a raw available session IS={i1,i2,,it}I_{S}=\{i_{1},i_{2},\cdots,i_{t}\} is encoded into {h1,h2,,ht}\{h_{1},h_{2},\cdots,h_{t}\}.

Same as how SR-GNN encodes each session, we will use a GNN to encode side information SideSSide_{S}. However, SideSSide_{S} can only be a set of integers but not a set of set of integers. This means that sjSideSs_{j}\in Side_{S} can only corresponds to one category of the categorical variable, such as the only category of an item, rather than multiple categories of the categorical variable, such as the various genres of a movie. The reason is that GNN uses the edge between two nodes to represent transition between two items or two categories. However, it is hard for GNN to represents transition between two sets of categories since this cannot be simply represented as an edge between two nodes. Thus, we only focus on the case in which SideSSide_{S} is a set of integers when evaluating how incorporating side information influences the model’s behavior, and this means that we will only focus on Diginetica and TaFeng and ignore MovieLens.

After the GNN side information encoder, the raw side information SideS={s1,s2,,st}Side_{S}=\{s_{1},s_{2},\cdots,s_{t}\} is encoded into hs={h1s,h2s,,hts}h^{s}=\{h^{s}_{1},h^{s}_{2},\cdots,h^{s}_{t}\}.

For both RepeatNet and SR-GNN, after obtaining hi={h1i,h2i,,hti}h^{i}=\{h^{i}_{1},h^{i}_{2},\cdots,h^{i}_{t}\} and hs={h1s,h2s,,hts}h^{s}=\{h^{s}_{1},h^{s}_{2},\cdots,h^{s}_{t}\}, we generate h={h1,h2,,ht}h=\{h_{1},h_{2},\cdots,h_{t}\} based on hsh^{s} and hih^{i}, where hjhh_{j}\in h is obtained by concatenating hjih^{i}_{j} and hjsh^{s}_{j} together. We then use this new hh in remaining parts of the RepeatNet or SR-GNN.

6.2 Attention loss

Ideally, the model should pay more attention to an item in a session if that item is similar to the target item. We believe that we can use the attention mechanism more carefully when calculating the vector representing the entire session in both RepeatNet and SR-GNN. Thus, we here propose the attention loss for items as follows:

Litem attention(θ)=1|𝕀𝕊|IS𝕀𝕊r=2|IS|t=1r1𝟙(it=ir)|{j|ijIS[1:r1],ij=ir}|log(αt)\displaystyle L_{\text{item attention}}(\theta)=-\frac{1}{|\mathbb{I_{S}}|}\sum_{I_{S}\in\mathbb{I_{S}}}\sum_{r=2}^{|I_{S}|}\sum_{t=1}^{r-1}\frac{\mathbbm{1}(i_{t}=i_{r})}{|\{j|i_{j}\in I_{S}[1:r-1],i_{j}=i_{r}\}|}\log(\alpha_{t}) (13)

where 𝕀𝕊\mathbb{I_{S}} represents the set containing all sessions and αt\alpha_{t} is the attention weight assigned to the item and side information pair at time step tt. This loss would encourage the attention weights assigned to items that are different from the target item to be 0 and encourage the attention to be uniformly distributed among items that are identical to the target item.

Additionally, we calculate the attention loss for side information as follows:

Lside attention(θ)=1|𝕀𝕊|IS𝕀𝕊r=2|IS|t=1r1𝟙(st=sr)|{j|sjSideS[1:r1],sj=sr}|log(αt)\displaystyle L_{\text{side attention}}(\theta)=-\frac{1}{|\mathbb{I_{S}}|}\sum_{I_{S}\in\mathbb{I_{S}}}\sum_{r=2}^{|I_{S}|}\sum_{t=1}^{r-1}\frac{\mathbbm{1}(s_{t}=s_{r})}{|\{j|s_{j}\in Side_{S}[1:r-1],s_{j}=s_{r}\}|}\log(\alpha_{t}) (14)

where SideSSide_{S} represents the side information corresponding to the session ISI_{S}. The above loss encourages the model to pay more attention to an item in a session if that item and the target item share the same side information, and ignore items that do not share the same side information with the target item.

We define:

ItemTarget(IS,t,r)=𝟙(it=ir)|{j|ijIS[1:r1],ij=ir}|\displaystyle\text{ItemTarget}(I_{S},t,r)=\frac{\mathbbm{1}(i_{t}=i_{r})}{|\{j|i_{j}\in I_{S}[1:r-1],i_{j}=i_{r}\}|} (15)
SideTarget(SideS,t,r)=𝟙(st=sr)|{j|sjSideS[1:r1],sj=sr}|\displaystyle\text{SideTarget}(Side_{S},t,r)=\frac{\mathbbm{1}(s_{t}=s_{r})}{|\{j|s_{j}\in Side_{S}[1:r-1],s_{j}=s_{r}\}|} (16)

Then, the attention loss we incorporate into the loss term of the model would be:

Lattention(θ)=1|𝕀𝕊|IS𝕀𝕊r=2|IS|t=1r1ItemTarget(IS,t,r)+SideTarget(SideS,t,r)2log(αt)\displaystyle L_{\text{attention}}(\theta)=-\frac{1}{|\mathbb{I_{S}}|}\sum_{I_{S}\in\mathbb{I_{S}}}\sum_{r=2}^{|I_{S}|}\sum_{t=1}^{r-1}\frac{\text{ItemTarget}(I_{S},t,r)+\text{SideTarget}(Side_{S},t,r)}{2}\log(\alpha_{t}) (17)

The attention loss defined above encourages the model to pay more attention to an item in a session if that item is identical to the target item, or if that item shares the same side information with the target item.

7 Experimental result

7.1 Experiment setup

To achieve fair and comparable experimental results, we follow the model hyperparameter settings as described in the models’ original paper (RepeatNet (Ren et al., 2019) and SR-GNN (Wu et al., 2019)).

Specifically, for RepeatNet, we set item embedding size sitem_embedding=100s_{\texttt{item\_embedding}}=100, side embedding size sside_embedding=100s_{\texttt{side\_embedding}}=100, hidden size shidden=100s_{\texttt{hidden}}=100, and the item vocab size and side vocab size vary by dataset. We use a batch size of 128128 and an Adam optimizer with initial learning rate lr=1e3lr=1e-3, β1=0.9\beta_{1}=0.9, β2=0.999\beta_{2}=0.999 and the learning rate halves every 55 epochs.

For SR-GNN, we set we set item embedding size sitem_embedding=100s_{\texttt{item\_embedding}}=100, side embedding size sside_embedding=100s_{\texttt{side\_embedding}}=100, and the item vocab size and side vocab size vary by dataset. We use a batch size of 100100 and an Adam optimizer with initial learning rate lr=1e3lr=1e-3, β1=0.9\beta_{1}=0.9, β2=0.999\beta_{2}=0.999, weight on L2L_{2} penalty being 1e51e-5 and the learning rate halves every 33 epochs with early stopping mechanism.

7.2 Evaluation metrics

We mainly use Recall and MRR as our evaluation metrics. We calculate MRR@20 and Recall@20, the percentage of true answer ranking in the top 20 of our predictions. And MRR is the mean reciprocal rank calculated by MRR=1Ni=1N1ranki\text{MRR}=\frac{1}{N}\sum_{i=1}^{N}\frac{1}{\text{rank}_{i}}. The reciprocal rank is set to 0 if it lies beyond top 20 for MRR@20.

7.3 Evaluating the effect of incorporating side information

7.3.1 Performance

We summarize our main experimental statistics as below. In addition to Table 3 representing the best results achieved on each dataset in terms of both metrics, we also provide a visualization of the learning process for RepeatNet in Figure 5. We will get into detailed analysis in Section 7.3.2.

Refer to caption
(a) TaFeng
Refer to caption
(b) Diginetica
Refer to caption
(c) MovieLens
Figure 5: RepeatNet Performance
Maximum highlighted
Dataset TaFeng Diginetica MovieLens
Model RepeatNet SR-GNN RepeatNet SR-GNN RepeatNet
Metrics
no
side
side
no
side
side
no
side
side
no
side
side
no
side
side
Recall@20 10.17 11.09 9.49 10.42 52.33 53.39 50.54 52.14 14.77 15.40
MRR@20 3.37 3.68 3.01 3.21 18.27 18.95 17.48 17.64 4.25 4.62
Table 3: performance metrics

7.3.2 Analysis

From Table 3, we could observe that with side information incorporated, the model performance improves on all metrics by a considerable margin. This applies to all datasets and models we experimented, which exemplifies the universality of our framework for incorporating side information into neural network based recommender system. It is also worth noting that we achieved the state-of-the-art performance on Diginetica dataset. The previous state-of-the-art performance on Diginetica was achieved by NISER+ (Gupta et al., 2021), and the reported performance was 18.72 in terms of MRR@20 and 53.39 in terms of Recall@20.

Additionally, we notice from the learning process plots that, with side information, RepeatNet converges better and faster if the side information framework is applied. SR-GNN also converges faster and better: without side information, SR-GNN converges in three epochs; with side information, SR-GNN is able to converge in two epochs. This spells a dramatic difference of resources and time invested for real life industry-scale applications.

Dataset: Diginetica SR-GNN SR-GNN SR-GNN RepeatNet RepeatNet RepeatNet
Embedding Size 100 200 100 100 200 100
Side information Without Without With Without Without With
Recall@20 50.54 49.39 52.14 52.33 52.00 53.39
MRR@20 17.48 16.78 17.64 18.27 18.00 18.95
Table 4: Effect of model’s size

To confirm that the performance improvement is not resulting from simply increasing the sizes of models, we doubled the size of embedding vectors for both SR-GNN and RepeatNet. This manipulation allows the model without side information to have a same size compared with the model that has a side information encoder. We evaluated the enlarged models on Diginetica dataset, and compared those enlarged models with models with side information encoder. The result is shown in Table 4. From the table, we can see that increasing the size of model doesn’t lead to performance gain, which suggests that our success is not resulting from simply increasing the number of parameters.

7.4 Evaluating the effect of attention loss

7.4.1 Performance

We experimented with the effectiveness of attention loss by testing SR-GNN model on TaFeng dataset. In particular, we incorporated and tested the attention loss proposed in Section 6.2 with various weights. The result is shown in Figure 6.

Refer to caption
Figure 6: Effect of attention loss

7.4.2 Analysis

From Figure 6 we can see that both metrics become worse as we increase the weight of attention loss. This means that the attention loss is not able to boost the performance of the recommender system. We still believe that the model should pay more attention to an item in a session if that item is identical to the target item or that item shares the same side information with the target item. However, our proposed attention loss fails to improve model performance, and we hypothesize that the reason behind is that it is hard to set the correct target for attention used in attention loss, as there is no convincing theory guiding us to set the target.

8 Conclusion

In this paper, we present a general framework to incorporate side information into session-based recommender systems using neural network architectures. Our experiments based on RepeatNet and SR-GNN using the Diginetica, MovieLens, and Ta Feng datasets confirm that the use of side information can be easily applied to deep neural network models of various architectures and help boost their performance. Not only does our method achieve better results than prior approaches, including some state-of-the-art models, it also shortens the time taken to converge.

Limitations

There are mainly two limitations of this work. Firstly, the method is only targeting general deep neural networks but may not be applicable to other models like KNN-based models. In addition, the performance of incorporating side information into existing models is highly dependent on the variety and quality of the side information. Secondly, under SR-GNN, the item to side information relationship can only be one-to-one. For example, if the genre of a movie is used as side information, but each movie has multiple genres, SR-GNN is not able to utilize all information except for using only one of them. We believe that these limitations can be insights that lead to promising future directions.

Code

To facilitate reproducibility of our results, we share the code for our experiments at https://github.com/YukunJ/11785-Final-Project-Team15.

References

  • Gupta et al. [2021] Priyanka Gupta, Diksha Garg, Pankaj Malhotra, Lovekesh Vig, and Gautam Shroff. Niser: Normalized item and session representations to handle popularity bias, 2021.
  • Meng et al. [2020] Wenjing Meng, Deqing Yang, and Yanghua Xiao. Incorporating user micro-behaviors and item knowledge into multi-task learning for session-based recommendation. Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval, Jul 2020. doi: 10.1145/3397271.3401098. URL http://dx.doi.org/10.1145/3397271.3401098.
  • Ren et al. [2019] Pengjie Ren, Zhumin Chen, Jing Li, Zhaochun Ren, Jun Ma, and Maarten Rijke. Repeatnet: A repeat aware neural recommendation machine for session-based recommendation. Proceedings of the AAAI Conference on Artificial Intelligence, 33:4806–4813, 07 2019. doi: 10.1609/aaai.v33i01.33014806.
  • Wang et al. [2021] Shoujin Wang, Longbing Cao, Yan Wang, Quan Z. Sheng, Mehmet Orgun, and Defu Lian. A survey on session-based recommender systems, 2021.
  • Wu et al. [2019] Shu Wu, Yuyuan Tang, Yanqiao Zhu, Liang Wang, Xing Xie, and Tieniu Tan. Session-based recommendation with graph neural networks. Proceedings of the AAAI Conference on Artificial Intelligence, 33:346–353, Jul 2019. ISSN 2159-5399. doi: 10.1609/aaai.v33i01.3301346. URL http://dx.doi.org/10.1609/aaai.v33i01.3301346.

Appendix A Appendix

A.1 RepeatNet Architecture

Given an available session IS={i1,i2,,ij,,it}I_{S}=\{i_{1},i_{2},\cdots,i_{j},\cdots,i_{t}\} where iji_{j} refers to the jj-th action (purchasing, browsing, etc.), any session-based recommender system aims to predict the next action through a probabilistic interpretation 𝐏(it+1|IS)\mathbf{P}(i_{t+1}|I_{S}). The RepeatNet utilizes the insights that people tend to repeat their action along the timeline, and design two modes of people’s next action: Exploration(ee) or Repeat(rr). Mathematically, it is written

𝐏(it+1|IS)\displaystyle\mathbf{P}(i_{t+1}|I_{S}) =𝐏(it+1|IS,e)𝐏(e|IS)+𝐏(it+1|IS,r)𝐏(r|IS)\displaystyle=\mathbf{P}(i_{t+1}|I_{S},e)\mathbf{P}(e|I_{S})+\mathbf{P}(i_{t+1}|I_{S},r)\mathbf{P}(r|I_{S}) (18)

To be able to compute each probabilistic component of the above equation, they designed an attention-based recurrent neural network architecture, mainly in four units, and modified objective function:

  • Session encoder

  • Repeat-or-explore mechanism

  • Repeat mode decoder

  • Explore mode decoder

  • Repeat-explore loss

A.1.1 Session encoder

A Gated Recurrent Unit (GRU) is used to encode the session ISI_{S}. Specifically, the GRU works as follows:

zr\displaystyle z_{r} =σ(Wz[emb(ir),hr1])\displaystyle=\sigma(W_{z}[emb(i_{r}),h_{r-1}]) (19)
rr\displaystyle r_{r} =σ(Wr[emb(ir),hr1])\displaystyle=\sigma(W_{r}[emb(i_{r}),h_{r-1}]) (20)
hr~\displaystyle\tilde{h_{r}} =tanh(Wh[emb(ir),rrhr1])\displaystyle=\tanh(W_{h}[emb(i_{r}),r_{r}\odot h_{r-1}]) (21)
hr\displaystyle h_{r} =(1zr)hr1+zrhr~\displaystyle=(1-z_{r})\odot h_{r-1}+z_{r}\odot\tilde{h_{r}} (22)

where Wz,Wr,WhW_{z},W_{r},W_{h}, and emb(ir)emb(i_{r}) are learnable parameters. After this GRU session encoder, a raw available session IS={i1,i2,,it}I_{S}=\{i_{1},i_{2},\cdots,i_{t}\} is encoded into {h1,h2,,ht}\{h_{1},h_{2},\cdots,h_{t}\}.

A.1.2 Repeat-or-explore mechanism

The next problem is to produce a binary probability of repeat mode and explore mode. To that end, they adopt the attention technique using the last hidden state hth_{t} with each individual hidden state hrh_{r}. Mathematically, it is

erre\displaystyle e^{re}_{r} =vretanh(Wreht+Urehr)\displaystyle=v_{re}\tanh(W_{re}h_{t}+U_{re}h_{r}) (23)
αrre\displaystyle\alpha^{re}_{r} =exp(erre)iexp(eire)\displaystyle=\frac{\exp(e^{re}_{r})}{\sum_{i}\exp(e^{re}_{i})} (24)
csession\displaystyle c_{\text{session}} =iαirehi\displaystyle=\sum_{i}\alpha^{re}_{i}h_{i} (25)

where vre,Wre,Urev_{re},W_{re},U_{re} are learnable parameters and csessionc_{\text{session}} is the final repeat-or-explore attention vector they attain. The final step is to transform this attention vector is a binary probability through

[𝐏(r|IS),𝐏(e|Is)]=softmax(WTcsession)\displaystyle[\mathbf{P}(r|I_{S}),\mathbf{P}(e|I_{s})]=\text{softmax}(W_{\text{T}}c_{\text{session}}) (26)

where again WTW_{\text{T}} is again a learnable matrix parameter.

A.1.3 Repeat mode decoder

The repeat mode decoder essentially computes the probability 𝐏(it+1|IS,r)\mathbf{P}(i_{t+1}|I_{S},r) for any action/item on condition that such an action/item has already appeared in the available session. Mathematically, it is computed using attention mechanism as follows:

err\displaystyle e^{r}_{r} =vrTtanh(Wrht+Urhr)\displaystyle=v_{r}^{T}\tanh(W_{r}h_{t}+U_{r}h_{r}) (27)
𝐏(i|IS,r)\displaystyle\mathbf{P}(i|I_{S},r) ={iexp(eir)texp(etr),if iIS0,if iIS\displaystyle=\begin{cases}\frac{\sum_{i}\exp(e^{r}_{i})}{\sum_{t}\exp(e^{r}_{t})},\text{if }i\in I_{S}\\ 0,\text{if }i\notin I_{S}\end{cases} (28)

where vr,Wr,Urv_{r},W_{r},U_{r} are learnable parameters. Notice that the summation in the numerator is because an item ii might already repeat multiple times in the available session ISI_{S}.

A.1.4 Explore mode decoder

The explore mode decoder computes the probability of selecting next action/item ii that’s not in the current available session so far. To capture user’s interest in this session, firstly they compute the item-level attention:

ere\displaystyle e^{e}_{r} =veTtanh(Weht+Uehr)\displaystyle=v_{e}^{T}\tanh(W_{e}h_{t}+U_{e}h_{r}) (30)
αre\displaystyle\alpha^{e}_{r} =exp(ere)texp(ete)\displaystyle=\frac{\exp(e^{e}_{r})}{\sum_{t}\exp(e^{e}_{t})} (31)
csessione\displaystyle c^{e}_{\text{session}} =tαteht\displaystyle=\sum_{t}\alpha^{e}_{t}h_{t} (32)

where again ve,We,Uev_{e},W_{e},U_{e} are learnable parameters. Then they concatenate the last hidden state hth_{t} with the attention vector csessionec^{e}_{\text{session}} into cIS=[ht,csessione]c_{I_{S}}=[h_{t},c^{e}_{\text{session}}]. Finally they use this to compute the explore probability as follows:

fi\displaystyle f_{i} ={,if iISVecIS,if iIS\displaystyle=\begin{cases}-\infty,\text{if }i\in I_{S}\\ V_{e}c_{I_{S}},\text{if }i\not\in I_{S}\end{cases} (33)
𝐏(i|IS,e)\displaystyle\mathbf{P}(i|I_{S},e) =softmax(fi)\displaystyle=\text{softmax}(f_{i}) (34)

A.1.5 Repeat-explore loss

In training the RepeatNet, the team not only uses the normal negative log-likelihood loss function but also adds an explore-repeat loss to facilitate the learning of when to switch the explore mode or repeat mode. Mathematically, we define the negative log-likelihood loss as

Lnormal(θ)=1|𝕀𝕊|IS𝕀𝕊r=2|IS|log(𝐏(ir|IS[:r1]))\displaystyle L_{\text{normal}}(\theta)=-\frac{1}{|\mathbb{I_{S}}|}\sum_{I_{S}\in\mathbb{I_{S}}}\sum_{r=2}^{|I_{S}|}\log(\mathbf{P}(i_{r}|I_{S}[:r-1])) (35)

where IS[:r1]I_{S}[:r-1] represents the first r1r-1 items of session ISI_{S}, and the repeat-explore loss as

Lr-e(θ)=1|𝕀𝕊|IS𝕀𝕊r=2|IS|𝟙(irIS[:r1])log(𝐏(r|IS[:r1]))+𝟙(irIS[:r1])log(𝐏(e|IS[:r1]))\displaystyle L_{\text{r-e}}(\theta)=-\frac{1}{|\mathbb{I_{S}}|}\sum_{I_{S}\in\mathbb{I_{S}}}\sum_{r=2}^{|I_{S}|}\mathbbm{1}(i_{r}\in I_{S}[:r-1])\log(\mathbf{P}(r|I_{S}[:r-1]))+\mathbbm{1}(i_{r}\not\in I_{S}[:r-1])\log(\mathbf{P}(e|I_{S}[:r-1])) (36)

and the final loss function objective is defined as

L(θ)=Lnormal(θ)+Lr-e(θ)\displaystyle L(\theta)=L_{\text{normal}}(\theta)+L_{\text{r-e}}(\theta) (37)

A.2 SR-GNN Architecture

For SR-GNN, we follow the implementation of Wu et al. [2019]. SR-GNN aims to generate precise item embeddings while taking complex transitions of items into account, where sessions will be modeled as graph structures and items will be modeled as nodes, allowing automatic extraction of features with respect to node connections. The model uses an attention network to represent each session’s long-term interest, and each session is represented as the combination of long-term interest and current interest. It then uses session embeddings created from latent vectors of items to generate recommendations. Their design can be summarized into 4 components:

  • Construct session graphs

  • Learn item embeddings of session graphs

  • Generate session embeddings

  • Make recommendations

A.2.1 Construct session graphs

SR-GNN uses a directed graph 𝒢\mathcal{G} to model each session, where items are represented as nodes of the graph. User interactions as click or purchases are represented as edges, where edge (𝒱s,i1,𝒱s,i)𝒢(\mathcal{V}_{s,i-1},\mathcal{V}_{s,i})\in\mathcal{G} s\mathcal{E}_{s} means the user clicked item i1i-1 before item ii in the current session ss, such that the transitions of items can be captured by the model. The model normalized the weights of the edges to account for repetitions of items. The weight is calculated by number occurrence of edgeout degree of edge’s start node\displaystyle\frac{\textrm{number occurrence of edge}}{\textrm{out degree of edge\textquoteright s start node}}.

A.2.2 Learn item embeddings of session graphs

Each item vVv\in V is embedded into a unified space and the node vector 𝐯d\mathbf{v}\in\mathbb{R}^{d} represents the latent vector of item vv learned through graph neural networks. For graph 𝒢s\mathcal{G}_{s} corresponding to session ISI_{S}, the weight connections of incoming and outgoing edges are represented by matrices As(out)A^{(out)}_{s} and As(in)A^{(in)}_{s}, with AsA_{s} being the concatenation of these matrices in each session.

For the node vs,iv_{s,i} of graph 𝒢s\mathcal{G}_{s} corresponding to session ISI_{S}, the update functions are given as follows:

as,it\displaystyle a^{t}_{s,i} =As,i:[𝐯1t1,,𝐯nt1]TH+b\displaystyle=A_{s,i:}[\mathbf{v}^{t-1}_{1},...,\mathbf{v}^{t-1}_{n}]^{T}H+b (38)
zs,it\displaystyle z^{t}_{s,i} =σ(Wzas,it+Uz𝐯it1)\displaystyle=\sigma(W_{z}a^{t}_{s,i}+U_{z}\mathbf{v}^{t-1}_{i}) (39)
rs,it\displaystyle r^{t}_{s,i} =σ(Wras,it+Ur𝐯it1)\displaystyle=\sigma(W_{r}a^{t}_{s,i}+U_{r}\mathbf{v}^{t-1}_{i}) (40)
𝐯it~\displaystyle\tilde{\mathbf{v}^{t}_{i}} =tanh(Woas,it+Uo(rs,it𝐯it1))\displaystyle=tanh(W_{o}a^{t}_{s,i}+U_{o}(r^{t}_{s,i}\odot\mathbf{v}^{t-1}_{i})) (41)
𝐯it\displaystyle\mathbf{v}^{t}_{i} =(1zs,it)𝐯it1+zs,it𝐯it~\displaystyle=(1-z^{t}_{s,i})\odot\mathbf{v}^{t-1}_{i}+z^{t}_{s,i}\odot\tilde{\mathbf{v}^{t}_{i}} (42)

Where As,i:1×2nA_{s,i:}\in\mathbb{R}^{1\times 2n} is a row in AsA_{s} corresponding to node vs,iv_{s,i} and Hd×2dH\in\mathbb{R}^{d\times 2d} controls the weight. Information is propagated by equation (38), using the restrictions of A as the model proceeds each session. It extracts latent vectors of adjacent nodes, which are later fed into the network. The update gate zs,iz_{s,i} decides what information is retained, and the reset gate rs,ir_{s,i} decides what is discarded. The final state combines the hidden states and the current candidate state, which is determined by the previous and current states, and the final node vector is retrieved when all nodes in the session are updated until convergence.

A.2.3 Generate session embeddings

SR-GNN uses node vectors in each session to represent the current interest and the long-term interest of each session. Each session is represented as a long-term-interest embedding vector sg\textbf{s}_{g} that is obtained from aggregating embeddings of all items in the session, concatenated with the current-interest embedding vector sl\textbf{s}_{l}, which is the embedding of the last item in the session. SR-GNN uses a soft-attention mechanism was used to prioritize different interests when calculating the long-term-interest embedding vector.

αi\displaystyle\alpha_{i} =qTσ(W1𝐯n+W2𝐯i+c)\displaystyle=q^{T}\sigma(W_{1}\mathbf{v}_{n}+W_{2}\mathbf{v}_{i}+c) (43)
sg\displaystyle s_{g} =i=1nαi𝐯i\displaystyle=\displaystyle\sum^{n}_{i=1}\alpha_{i}\mathbf{v}_{i} (44)

Where qdq\in\mathbb{R}^{d} and W1,W2d×dW_{1},W_{2}\in\mathbb{R}^{d\times d} control the item embedding vectors’ weights. The final hybrid embedding is obtained by a linear transformation of the concatenation of the current-interest embedding vector and long-term-interest embedding vector.

sh=W3[s1;sg]\displaystyle s_{h}=W_{3}[s_{1};s_{g}] (45)

A.2.4 Make recommendations

A recommendation score z^\hat{z} is computed using the embedding of each session calculated in the last component by:

z^i=shT𝐯i\displaystyle\hat{z}_{i}=s^{T}_{h}\mathbf{v}_{i} (46)

The output vector y^\hat{y} of model is obtained using a soft-max function of the recommendation score:

y^=softmax(z^)\displaystyle\hat{y}=softmax(\hat{z}) (47)

They define their loss function using cross-entropy of the predicted value and the real value:

L(y^)=i=1myilog(y^i)+(1yi)log(1y^i)\displaystyle L(\hat{y})=-\displaystyle\sum^{m}_{i=1}y_{i}log(\hat{y}_{i})+(1-y_{i})log(1-\hat{y}_{i}) (48)

Where y is a one-hot encoding of the real value of each item.