Student: Kong Lingdong (A0260240X)
Title: "User-Specific Recommendation with K-GCN"
Time: AY 2022-2023, Semester II
This repository contains the code and implementation details of the Paper Review assignment for the CS6208 course. In this assignment, we review Knowledge Graph Convolutional Network (K-GCN), with an application on a movie recommendation scenarios.
Collaborative filtering is a traditional technique for solving user-specific recommendation problems, but it has several drawbacks, such as the sparsity of user-item interactions. (Wang et al., 2018) and (Huang et al., 2018) have used knowledge graphs (KG) to overcome these issues, which are heterogeneous graphs with nodes
and edges
representing item attributes
and relations
, respectively, and build feature- and connection-rich scenarios to improve precision. Graph neural networks, specifically graph convolutional networks (GCN), have become powerful tools for processing such data. (Wang et al., 2019) combined KG and GCN in recommendation systems to achieve good performance on multiple datasets. This assignment reviews this knowledge graph convolutional network (K-GCN) through a user-specific movie recommendation problem.
Fig. Illustrations of (a) A two-layer receptive field of an entity (blue node) in a KG. (b) The framework of K-GCN. Images adopted from (Wang et al., 2019).
This codebase is tested with torch==1.11.0
with CUDA 11.3
. In order to successfully reproduce the results reported, we recommend to follow the exact same configuation. However, similar versions that came out lately should be good as well.
- Step 1: Create Enviroment
conda create -n my_kgcn python=3.10
- Step 2: Activate Enviroment
conda activate my_kgcn
- Step 3: Install PyTorch
conda install pytorch==1.11.0 torchvision==0.12.0 cudatoolkit=11.3 -c pytorch
- Step 4: Install Necessary Libraries
pip install numpy matplotlib sklearn pandas
We subsample a 10% subset of MovieLens-20M as our dataset, where ratings greater than 3 are considered positive. We split the dataset into a training set and a test set in an 8:2 ratio and use the KG from (Wang et al., 2019).
Download the complete MovieLens-20M using the following commands:
wget http://files.grouplens.org/datasets/movielens/ml-20m.zip
unzip ml-20m.zip
mv ml-20m/ratings.csv data/movie/
Alternatively, you can download the data from my Google Drive via the following link:
🔗 https://drive.google.com/file/d/1nyqaNs-HboPjFuGowENWgQUsRBM-zJFV/view?usp=sharing.
Then, uncompress this .zip
file and replace the current data/movie/
folder.
The K-GCN framework is implemented by the following components:
data_loader.py
: Prepare and load movie recommendation data.model.py
: Reproduce the K-GCN model.aggregator.py
: Reproduce the Sum and Concat aggragators in K-GCN.
The main scripts are provided in the myKGCN.ipynb
notebook, with reproducible steps. Follow the procedures in this notebook then you can get the exact same outputs as those in the submitted report.
The configuration of the ablation study is attached as follows:
# | Variant | Aggregator Type | Number of Iterations | Number of Embedding Dimensions |
---|---|---|---|---|
(a) | Iter1_Sum_Dim16 |
Summation | 1 | 16 |
(b) | Iter2_Sum_Dim16 |
Summation | 2 | 16 |
(c) | Iter2_Sum_Dim32 |
Summation | 2 | 32 |
(d) | Iter1_Concat_Dim16 |
Concatenation | 1 | 16 |
(e) | Iter2_Concat_Dim16 |
Concatenation | 2 | 16 |
(f) | Iter2_Concat_Dim32 |
Concatenation | 2 | 32 |
Variant | (a) | (b) | (c) | (d) | (e) | (f) |
---|---|---|---|---|---|---|
Accuracy Score | 0.975 | 0.958 | 0.960 | 0.984 | 0.976 | 0.977 |
- (Wang et al., 2018) Wang, H., Zhang, F., Wang, J., Zhao, M., Li, W., Xie, X., and Guo, M. "Ripplenet: Propagating user preferences on the knowledge graph for recommender systems." In Proceedings of the ACM International Conference on Information and Knowledge Management, pp. 417–426, 2018.
- (Huang et al., 2018) Huang, J., Zhao, W. X., Dou, H., Wen, J.-R., and Chang, E. Y. "Improving sequential recommendation with knowledge-enhanced memory networks." In ACM SIGIR Conference on Research & Development in Information Retrieval, pp. 505–514, 2018.
- (Wang et al., 2019) Wang, H., Zhao, M., Xie, X., Li, W., and Guo, M. "Knowledge graph convolutional networks for recommender systems." In The World Wide Web Conference (WWW), pp. 3307–3313, 2019.