Framework for interactive recommendation system based on reinforcement learning taking leverage of knowledge graph
Contents table
KGQR is the first trial to use knowledge graph prior on interactive recommendation system based on reinforcement learning.
"Interactive Recommender System via Knowledge
Graph-enhanced Reinforcement Learning"
python >= 3.7
-
Download ratings.csv to raw_data folder.
In raw_data folder, there should be ratings.csv, kg.txt, item_index2enity_id.txt files
-
Preprocess rating file and knowledge graph file
This will generate data folder and sorting.csv
python preprocess.py
-
Train the model
python train.py
-
raw_data
movie
kg.txt
: knowledge graph file;ratrings.csv
: raw rating file of Movielens-20M dataset;item_index2entity_id.txt
: the mapping 3from item indices in the raw rating file to entity IDs in the KG;sorted.csv(generated by preprocess.py)
: sorted (by user id and timestamp) rating file of Movielens-20M dataset;
-
data(generated by preprocess.py)
: preprocessed filesmovie
*_vocab.pkl
: Change indicators in raw_data files to index used in this projectn_hop_kg.pkl
: save entity's ids in 2 hop;n_hop_kg.pkl[entity_id][1] = list of 1-hop entity ids n_hop_kg.pkl[entity_id][2] = list of 2-hop entity ids
kg_adj_mat.npy
: Knowledge graph's adjacent nodes information;*_data_dict.pkl
: can refer user's rating history sorted in chronological order by user_id;