Skip to content

Go0day/TPRec

Repository files navigation

TPRec

This repository contains the source code of the TOIS 2022 paper "Time-aware Path Reasoning on Knowledge Graph for Recommendation" [1].

Datasets

We obtain the data from PGPR[2,3]. Three Amazon datasets used in this paper can be download here.

Requirements

  • Python >= 3.6
  • PyTorch = 1.0

How to run the code

  1. Preprocess the temporal information.
python GMM_process.py --dataset <dataset_name> --cluster_num <num> --cluster_feature <temporal_feature>

"<dataset_name>" should be one of "beauty", "cloth", "cell" (refer to utils.py). "temporal_feature" should be one of "all", "w-stru", "w-stat".

  1. Preprocess the data:
python preprocess.py --dataset <dataset_name>
  1. Train Time-aware Collaborative Knowledge Graph embeddings:
python train_transe_model.py --dataset <dataset_name>

In order to reduce the training time, it is better to put the embedding without time information into the "tmp/<dataset_name>/init_embedding/" folder in advance, which can be be obtained from the third step of PGPR[2,3], or downloaded from here.

  1. Train RL agent:
python train_agent.py --dataset <dataset_name>
  1. Evaluation
python test_agent.py --dataset <dataset_name>

References

[1] Yuyue Zhao, Xiang Wang, Jiawei Chen, Wei Tang, Yashen Wang, Xiangnan He, Haiyong Xie. Time-aware Path Reasoning on Knowledge Graph for Recommendation. arXiv preprint arXiv:2108.02634, 2021.

[2] Yikun Xian, Zuohui Fu, S. Muthukrishnan, Gerard de Melo, Yongfeng Zhang. "Reinforcement Knowledge Graph Reasoning for Explainable Recommendation." In Proceedings of SIGIR. 2019.

[3] The backbone implementation is reference to https://github.com/orcax/PGPR .

About

The source code of paper: Time-aware Path Reasoning on Knowledge Graph for Recommendation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages