Context-Aware Session-Based Recommendation With Graph Neural Networks
Context-Aware Session-Based Recommendation With Graph Neural Networks
period of time, and SBR aims to predict the next item based
arXiv:2310.09593v1 [cs.IR] 14 Oct 2023
ℎ3
s
G
෪1 ℎ
ℎ ෪2 ℎ ෪4 ℎ
෪3 ℎ ෪5 Prediction Layer
RGAT Layer
r×
s 𝑒1 𝑒2 𝑒3 𝑒4 𝑒5
𝜈1
𝜈4
Current session S1 : 𝑣5 𝑣5 𝑣1 𝑣3 𝑣4 𝑣2 Top-K retrieval
𝜈6
All session data:
𝜈8 𝜈2
S1 : 𝑣5 𝑣5 𝑣1 𝑣3 𝑣4 𝑣2 (𝑐2 𝑐2 𝑐1 𝑐4 𝑐3 𝑐3 )
𝜈5 Recent Session
𝜈7 𝜈3 S2 : 𝑣8 𝑣1 𝑣5 𝑣6 𝑣7 (𝑐2 𝑐1 𝑐2 𝑐1 𝑐3 )
Target Item Store
…
ŷi = Softmax(h⊤
s hi ), (13) 3 http://2015.recsyschallenge.com/challege
10−5 and the dimension of the hash matrix in SimHash is set to shows the effectiveness of introducing cross-session item-level
64. The candidate number of sessions is set to 1500 in the label context by graph modeling.
collaboration strategy. We set the parameter λ for adjusting the (2) CARES outperforms other GNN-based models SR-
loss weights to 0.1 for Deginetica 5 for Yoochoose1 64, and GNN, LESSER, AotoGSR, and SGNN-HN. This is because
10 for Tmall. We vary the number of retrieved target items in all these methods are designed for local sessions without con-
label collaboration from {10, 30, 50, 70, 90} and the number sidering cross-session information in the global view. While
of frequent contextual relations from {0, 5, 10, 20, 30} to study the cross-session method COTREC leverages self-supervision
their effects. for enhancing session representation, it ignores heterogeneity
and is outperformed by CARES .
C. Baselines (3) The leading performance of CARES and COTREC over
To verify the performance of our proposed model, we com- GCE-GNN implies that it is useful to capture the internal-
pared our model with 17 other methods, which can be grouped session-level context in the global graph because the latter
into three categories. Readers are referred to Section II for only considers the cross-session item-level context of item-
more details. transitions and lacks diversity in its collaborative informa-
tion. Therefore, COTREC employs self-supervised learning to
(Single Session methods): POP recommends the most
impose a divergence constraint on global view and internal-
popular items. Item-KNN [3] recommends items based on
session view of item embedding, while CARES further in-
the cosine similarity between items in the current session
troduces personalized item representation w.r.t sessions. This
and candidate items. FPMC [4] uses both Markov chain and
demonstrates the significance of the internal-session-level con-
Matrix Factorization to consider the user’s personalized and
text in global graph modeling.
general information. GRU4REC [7] exploits the memory of
(4) Our approach achieves the best performance in all the
GRUs by characterizing the entire sequence. NARM [5] and
datasets, which shows the importance of making full use
STAMP [6] further utilize attention mechanism additionally,
of contexts in sessions. Further, our model has a significant
which aims to capture the current interest and general interest
improvement in terms of MRR@20 on Diginetica and Yoo-
of the user. SRGNN [8], LESSER [14], SGNN-HN [12],
choose1 64, indicating that the item relevant to users’ interests
convert each session into a graph and do not utilize cross-
can be ranked higher, which is critical for user experience
session information.
improvement and confirms the superiority of our model.
(Cross Session methods): CSRM [9] incorporates the
(5) To ensure a fair comparison, we conducted experiments
relevant information in the neighborhood sessions through the
with an additional variant model that does not use side
memory network. CoSAN [10] utilizes multi-head attention
information to construct the graph. As shown in Table II,
mechanism to build dynamic item representations by fusing
even without utilizing the side information of the item’s
item representations in collaborative sessions. GCE-GNN [11]
category (aka CARES ns), our method still performs well
and MTD [32] simultaneously focus on cross-session and
across different datasets.
intra-session dependencies. COTREC [37] and S 2 -DHCN
[38] employ a global argumentation view of items to mine E. Ablation Study
informative self-supervision signals.
We conduct an ablation study on CARES to understand the
(Multi-relation methods): AutoGSR [16] and MGIR [35] characteristics of its main components. One variant updates
both learn multi-faceted item relations to enhance session rep- items’ embeddings by directly capturing information from
resentation. Note that MGIR utilizes cross-session information intra-session without utilizing general information to model
while AutoGSR does not. item-transition relationships on the global graph. This helps
us understand the importance of including cross-session item-
D. Overall performance
level context in SBR. We call this variant CARES ng (no
From the experimental results on the three datasets in general information). Another variant learns items’ embedding
Table II, we have the following observations: (1) It is observed without personalized information w.r.t sessions. We call this
that methods utilizing RNNs or attention mechanisms perform variant CARES np (no personalized information), which
better than early methods such as Item-KNN and FPMC helps us evaluate the effectiveness of internal-session-level
because they are both suitable for dealing with sequential context. To show the importance of the label collaboration
data with temporal information without losing the internal- strategy, we train the model with cross-entropy loss only
session-level context. Methods such as CSRM and CoSAN and call this variant CARES nl (no label collaboration).
offer higher performance for introducing auxiliary information CARES ns (no side information) represents the variant of
from historical sessions than single session methods like CARES without considering category information of items to
GRU4Rec, NARM and STAMP. This confirms the effective- understand the effect of items’ category association in SBR.
ness of leveraging external-session-level contexts. The current From the experimental results in Figure 4, the follow-
best-performing methods such as SGNN-HN, COTREC and ing observations are made. (i) Compared with CARES ng,
MGIR are GNN-based approaches because GNNs are good CARES leverages cross-session item-level context and thus
at capturing complex item-transitions across sessions, which can utilize diverse collaborative information from the global
Table II: Overall performance comparison on three datasets. For fairness, we directly report the results of baseline methods
from their original papers, where “-” indicates the absence of corresponding results in the original papers.
Diginetica Tmall Yoochoose1 64
Method P@20 MRR@20 P@20 MRR@20 P@20 MRR@20
POP 1.18 0.28 2.00 0.90 6.71 0.58
Item-KNN 35.75 11.57 9.15 3.31 51.60 21.81
FPMC 22.14 6.66 16.06 7.32 45.62 15.01
GRU4Rec 30.79 8.22 10.93 5.89 60.64 22.89
NARM 48.32 16.00 23.30 10.70 68.32 28.63
STAMP 46.62 15.13 26.47 13.36 68.74 29.67
SR-GNN 50.73 17.59 27.57 13.72 70.57 30.94
LESSR 51.71 18.15 23.53 9.56 70.05 30.59
SGNN-HN 55.67 19.45 − − 72.06 32.61
CSRM 48.49 17.13 29.46 13.96 − −
CoSAN 51.97 17.92 32.68 14.09 − −
GCE-GNN 54.22 19.04 33.42 15.42 70.91 30.63
S 2 -DHCN 53.18 18.44 31.42 15.05 − −
MTD 51.82 17.26 29.12 13.73 71.88 31.32
COTREC 54.18 19.07 36.35 18.04 − −
AutoGSR 54.56 19.20 33.71 15.87 71.77 31.02
MGIR − − 36.41 17.42 − −
CARES ns 55.29 21.04 38.17 17.79 71.82 33.05
CARES 56.49 23.22 38.77 18.37 72.21 34.40
Improv. 1.47% 19.30% 6.48% 1.82% 0.20% 5.48%
graph and outperform CARES ng. (ii) It can also be ob- G. Sensitivity Analysis of Hyper-Parameters
served that CARES with learning personalized information We end this section with a sensitivity analysis on the hyper-
beats CARES np on all the datasets. This indicates that parameters of CARES. In particular, we study two hyper-
internal-session-level context can effectively preserve user parameters: the hash matrix dimension m and the number
intent through adding personalized information w.r.t sessions. of retrieved sessions K. In our experiments, we vary one
(iii) CARES performs better than CARES nl, and this in- parameter each time with others fixed. Fig 6 illustrates the
dicates that utilizing the target items of historical sessions results with w.r.t. P@20 and MRR@20 scores on the datasets
with similar behavioral patterns to the current session as of Tmall and Yoochoose1 64. (Results on other datasets scores
external-session-level context can mitigate the bias in the user exhibit similar trends, and thus are omitted for space reasons.)
preference distribution. (iv) CARES also defeats CARES ns, From the figure, we see that
indicating that items’ category plays an important role in learn-
(1) A larger dimension m can slightly improve the perfor-
ing users’ preferences. Additionally, although side information
mance of the model. Since the model is not very sensitive to
improves recommendation accuracy, our model still performs
the hash matrix dimension, setting a small size of m can also
well without it, as shown in Table II.
guarantee the performance of the model.
(2) Fewer retrieved sessions in label collaboration are not
sufficient to provide enough information for the current ses-
F. Influence of Contextual Relations
sion. And there is also a performance drop when retrieving
In this section, we study how contextual relations affect the more sessions, which shows that a large number of collabo-
performance of the proposed method. Due to the limited space, rative sessions could contain noise that adversely affects the
we only show the results in terms of MRR@20. The results recommendation performance. So, an appropriate number of
are shown in Figure 5. From the results, we can see that the retrieved sessions K is essential.
models that do not use contextual relations always have lower
VI. CONCLUSION
performance. This is because contextual relations can help the
model capture more complex item context, which indicates In this paper, we propose a novel method named CARES
disentangling the relation semantics of sessions is a promising for session-based recommendation based on graph neural
direction for further exploiting the information across sessions. network. Specifically, it converts the session sequences into a
For different datasets, the optimal number of contextual rela- global graph with item attributes as context. The general item
tions is different. For the dataset Yoochoose1 64, the score representations are generated by various contextual relations
hits the highest when the relation number is set to 30. For through item-level attention. After that, we apply a gating
the other two datasets, the optimal relation number is 5 and mechanism to further enrich the representations of items with
we can see that increasing the number of relations does not personalized information w.r.t sessions. Then the intra- and
always result in a better performance. This is because only the cross-session context information are subsequently combined
relation between items’ categories with enough high frequency to enhance the recommendation performance. Finally, it in-
can be considered a context. corporates label collaboration to generate soft user preference
57.5 39.5 73.0
CARES_ns CARES_ns CARES_ns
57.0 CARES_ng CARES_ng CARES_ng
CARES_np 39.0 CARES_np 72.5 CARES_np
56.5 CARES_nl CARES_nl CARES_nl
CARES CARES CARES
38.5 72.0
56.0
P@20
P@20
P@20
55.5 38.0 71.5
55.0
37.5 71.0
54.5
37.0 70.5
54.0
53.5 36.5 70.0
Diginetica Tmall Yoochoose
18.8 36
CARES_ns CARES_ns CARES_ns
24 CARES_ng 18.6 CARES_ng CARES_ng
CARES_np CARES_np 35 CARES_np
CARES_nl CARES_nl CARES_nl
CARES 18.4 CARES CARES
22 34
18.2
MRR@20
MRR@20
MRR@20
20 33
18.0
18 17.8 32
17.6
16 31
17.4
30
Diginetica Tmall Yoochoose
R EFERENCES
[1] Charikar, Moses. “Similarity estimation techniques from rounding algo-
rithms.” Symposium on the Theory of Computing (2002).388.
[2] Chen, Qiwei, Changhua Pei, Shanshan Lv, Chao Li, Junfeng Ge and
Wenwu Ou. “End-to-End User Behavior Retrieval in Click-Through
RatePrediction Model.” ArXiv abs/2108.04468 (2021): n. pag.
[3] Sarwar, Badrul Munir, George Karypis, Joseph A. Konstan and John
Riedl. “Item-based collaborative filtering recommendation algorithms.”
Figure 5: Performance comparison on the number of contex- The Web Conference (2001).
tual relations [4] Rendle, Steffen, Christoph Freudenthaler and Lars Schmidt-Thieme.
“Factorizing personalized Markov chains for next-basket recommenda-
tion.” The Web Conference (2010).
[5] Li, Jing, Pengjie Ren, Zhumin Chen, Zhaochun Ren, Tao Lian and Jun
Ma. “Neural Attentive Session-based Recommendation.” Proceedings
of the 2017 ACM on Conference on Information and Knowledge
Management (2017): n. pag.
[6] Liu, Qiao, Yifu Zeng, Refuoe Mokhosi and Haibin Zhang. “STAMP:
Short-Term Attention/Memory Priority Model for Session-based Rec-
ommendation.” Proceedings of the 24th ACM SIGKDD International
Conference on Knowledge Discovery & Data Mining (2018): n. pag.
[7] Hidasi, Balázs, Alexandros Karatzoglou, Linas Baltrunas and Domonkos
Tikk. “Session-based Recommendations with Recurrent Neural Net-
works.” CoRR abs/1511.06939 (2015): n. pag.
[8] Wu, Shu, Yuyuan Tang, Yanqiao Zhu, Liang Wang, Xing Xie and Tieniu
Tan. “Session-based Recommendation with Graph Neural Networks.”
(a) m (b) K
ArXiv abs/1811.00855 (2018): n. pag.
Figure 6: Sensitivity Analysis of Hyper-Parameters [9] Wang, Meirui, Pengjie Ren, Lei Mei, Zhumin Chen, Jun Ma and M.
de Rijke. “A Collaborative Session-based Recommendation Approach
with Parallel Memory Modules.” Proceedings of the 42nd International
ACM SIGIR Conference on Research and Development in Information Supervised Learning for Sequential Recommendation with Mutual In-
Retrieval (2019): n. pag. formation Maximization.” Proceedings of the 29th ACM International
[10] Luo, Anjing, Pengpeng Zhao, Yanchi Liu, Fuzhen Zhuang, Deqing Conference on Information & Knowledge Management (2020): n. pag.
Wang, Jiajie Xu, Junhua Fang and Victor S. Sheng. “Collaborative Self- [30] Hidasi, Balázs, Massimo Quadrana, Alexandros Karatzoglou and
Attention Network for Session-based Recommendation.” International Domonkos Tikk. “Parallel Recurrent Neural Network Architectures for
Joint Conference on Artificial Intelligence (2020). Feature-rich Session-based Recommendations.” Proceedings of the 10th
[11] Wang, Ziyang, Wei Wei, G. Cong, Xiaoli Li, Xian-Ling Mao and ACM Conference on Recommender Systems (2016): n. pag.
Minghui Qiu. “Global Context Enhanced Graph Neural Networks for [31] Linden, Greg, Brent Smith and Jeremy York. “Amazon.com Recommen-
Session-based Recommendation.” Proceedings of the 43rd International dations: Item-to-Item Collaborative Filtering.” IEEE Distributed Syst.
ACM SIGIR Conference on Research and Development in Information Online 4 (2003): n. pag.
Retrieval (2020): n. pag. [32] Huang, Chao, Jiahui Chen, Lianghao Xia, Yong Xu, Peng Dai, Yanqing
[12] Pan, Zhiqiang, Fei Cai, Wanyu Chen, Honghui Chen and M. de Rijke. Chen, Liefeng Bo, Jiashu Zhao and Xiangji Huang. “Graph-Enhanced
“Star Graph Neural Networks for Session-based Recommendation.” Multi-Task Learning of Multi-Level Transition Dynamics for Session-
Proceedings of the 29th ACM International Conference on Information based Recommendation.” ArXiv abs/2110.03996 (2021): n. pag.
& Knowledge Management (2020): n. pag. [33] Fan, Shaohua, Junxiong Zhu, Xiaotian Han, Chuan Shi, Linmei Hu, Biyu
[13] Xu, Chengfeng, Pengpeng Zhao, Yanchi Liu, Victor S. Sheng, Jiajie Ma and Yongliang Li. “Metapath-guided Heterogeneous Graph Neural
Xu, Fuzhen Zhuang, Junhua Fang and Xiaofang Zhou. “Graph Contex- Network for Intent Recommendation.” Proceedings of the 25th ACM
tualized Self-Attention Network for Session-based Recommendation.” SIGKDD International Conference on Knowledge Discovery & Data
International Joint Conference on Artificial Intelligence (2019). Mining (2019): n. pag.
[14] Chen, Tianwen and Raymond Chi-Wing Wong. “Handling Information [34] Zhang, Xiaokun, Bo Xu, Liang Yang, Chenliang Li, Fenglong Ma,
Loss of Graph Neural Networks for Session-based Recommendation.” Haifeng Liu and Hongfei Lin. “Price DOES Matter!: Modeling Price and
Proceedings of the 26th ACM SIGKDD International Conference on Interest Preferences in Session-based Recommendation.” Proceedings
Knowledge Discovery & Data Mining (2020): n. pag. of the 45th International ACM SIGIR Conference on Research and
[15] Pan, Zhiqiang, Fei Cai, Wanyu Chen, Chonghao Chen and Honghui Development in Information Retrieval (2022): n. pag.
Chen. “Collaborative Graph Learning for Session-based Recommenda- [35] Han, Qilong, Chi Zhang, Rui Chen, Riwei Lai, Hongtao Song and Li
tion.” ACM Transactions on Information Systems (TOIS) 40 (2022): 1 Li. “Multi-Faceted Global Item Relation Learning for Session-Based
- 26. Recommendation.” Proceedings of the 45th International ACM SIGIR
[16] Chen, Jingfan, Guanghui Zhu, Haojun Hou, C. Yuan and Y. Huang. Conference on Research and Development in Information Retrieval
“AutoGSR: Neural Architecture Search for Graph-based Session Rec- (2022): n. pag.
ommendation.” Proceedings of the 45th International ACM SIGIR [36] Agrawal, Rakesh, Tomasz Imielinski and Arun N. Swami. “Mining
Conference on Research and Development in Information Retrieval association rules between sets of items in large databases.” ACM
(2022): n. pag. SIGMOD Conference (1993).
[17] Brody, Shaked, Uri Alon and Eran Yahav. “How Attentive are Graph [37] Xia, Xin, Hongzhi Yin, Junliang Yu, Yingxia Shao and Li-zhen Cui.
Attention Networks?” ArXiv abs/2105.14491 (2021): n. pag. “Self-Supervised Graph Co-Training for Session-based Recommenda-
[18] Zhu, Xiaojin, Zoubin Ghahramani and John D. Lafferty. “Semi- tion.” Proceedings of the 30th ACM International Conference on Infor-
Supervised Learning Using Gaussian Fields and Harmonic Functions.” mation & Knowledge Management (2021): n. pag.
International Conference on Machine Learning (2003). [38] Xia, Xin, Hongzhi Yin, Junliang Yu, Qinyong Wang, Li-zhen Cui
[19] Ye, Rui, Qing Zhang and Hengliang Luo. “Cross-Session Aware Tempo- and Xiangliang Zhang. “Self-Supervised Hypergraph Convolutional
ral Convolutional Network for Session-based Recommendation.” 2020 Networks for Session-based Recommendation.” AAAI Conference on
International Conference on Data Mining Workshops (ICDMW) (2020): Artificial Intelligence (2020).
220-226.
[20] Bai, Shaojie, J. Zico Kolter and Vladlen Koltun. “An Empirical Eval-
uation of Generic Convolutional and Recurrent Networks for Sequence
Modeling.” ArXiv abs/1803.01271 (2018): n. pag.
[21] Kipf, Thomas and Max Welling. “Semi-Supervised Classification with
Graph Convolutional Networks.” ArXiv abs/1609.02907 (2016): n. pag.
[22] Velickovic, Petar, Guillem Cucurull, Arantxa Casanova, Adriana
Romero, Pietro Lio’ and Yoshua Bengio. “Graph Attention Networks.”
ArXiv abs/1710.10903 (2017): n. pag.
[23] Li, Yujia, Daniel Tarlow, Marc Brockschmidt and Richard S. Zemel.
“Gated Graph Sequence Neural Networks.” CoRR abs/1511.05493
(2015): n. pag.
[24] Gupta, Priyanka, Diksha Garg, Pankaj Malhotra, Lovekesh Vig and Gau-
tam M. Shroff. “NISER: Normalized Item and Session Representations
with Graph Neural Networks.” ArXiv abs/1909.04276 (2019): n. pag.
[25] Tan, Yong Kiam, Xinxing Xu and Yong Liu. “Improved Recurrent
Neural Networks for Session-based Recommendations.” Proceedings of
the 1st Workshop on Deep Learning for Recommender Systems (2016):
n. pag.
[26] Hao, Junheng, Tong Zhao, Jin Li, Xin Luna Dong, Christos Faloutsos,
Yizhou Sun and Wei Wang. “P-Companion: A Principled Framework for
Diversified Complementary Product Recommendation.” Proceedings of
the 29th ACM International Conference on Information & Knowledge
Management (2020): n. pag.
[27] Xu, Keyulu, Chengtao Li, Yonglong Tian, Tomohiro Sonobe, Ken-
ichi Kawarabayashi and Stefanie Jegelka. “Representation Learning on
Graphs with Jumping Knowledge Networks.” International Conference
on Machine Learning (2018).
[28] Ahn, Dasom, Sangwon Kim, Hyun Wook Hong and ByoungChul Ko.
“STAR-Transformer: A Spatio-temporal Cross Attention Transformer
for Human Action Recognition.” 2023 IEEE/CVF Winter Conference
on Applications of Computer Vision (WACV) (2022): 3319-3328.
[29] Zhou, Kun, Haibo Wang, Wayne Xin Zhao, Yutao Zhu, Sirui Wang,
Fuzheng Zhang, Zhongyuan Wang and Ji-rong Wen. “S3-Rec: Self-