pip install -r requirements.txt
1. place flashback_data.zip into Graph_Flashback/data/ and unzip the file as following:
Graph_Flashback/data/checkins-gowalla.txt
Graph_Flashback/data/checkins-4sq.txt
2. place Graphs.zip into Graph_Flashback/KGE/ and unzip the file as following :
Graph_Flashback/KGE/Graphs/gowalla_scheme2_transe_loc_temporal_100.pkl
3. Optional, the pretrained-model are also provided, you can unzip the file into "data/" (e.g., Graph_Flashback/data/pretrained-model/gowalla_schema2) and use "scripts/construct_graphs.sh" for generating the graphs in this paper. (If you are interested in the code of pre-trained model, you can find the download link here) (including processed triplets files). Otherwise, we also provide the pure source code for training your models on your own datasets here, which needs to construct your triplets files. See Section Training new datasets for details.
4. The friend datasets have been uploaded into the data file. You can also download the user profile file by the link presented in Section 6 "EXPERIMENTS" in our paper.
Gowalla
python train.py --trans_loc_file KGE/Graphs/gowalla_scheme2_transe_loc_temporal_100.pkl --trans_interact_file KGE/Graphs/gowalla_scheme2_transe_user-loc_100.pkl --log_file results/log_gowalla
Foursquare
python train.py --dataset checkins-4sq.txt --trans_loc_file KGE/Graphs/foursquare_scheme2_transe_loc_temporal_20.pkl --trans_interact_file KGE/Graphs/foursquare_scheme2_transe_user-loc_100.pkl --log_file results/log_foursquare
In order to train your model on your own datasets, you should run "generate_triplet.py" by modifying some default settings such as dataset_file and DATA_NAME=
cd KGE
python generate_triplet.py --dataset <your_dataset>.txt --friendship <your_friend>.txt
python refine.py
Moreover, we provide the KGE code by the link, and you should delete the two original txt files: "final_test_triplets.txt" and "final_train_triplets.txt" and rename the "new_final_test_triplets.txt" into "final_test_triplets.txt", so do "new_final_train_triplets.txt", and copy the directory gowalla_scheme2 (i.e., './KGE/gowalla/gowalla_scheme2/') into the corresponding dir in KGE code, e.g., './datasets/gowalla/kg/'. The "relation2id.txt" is provided and used in same way, and the corresponding file name mapping is as follows:
entity2id.txt -> e_map.txt
final_train_triplets.txt -> train.txt
final_test_triplets.txt -> test.txt
relation2id.txt -> r_map.txt
Finally, using your pre-trained model to construct the location graph by the construct_loc_loc_graph.py, for example (see scripts/construct_graphs.sh),
cd KGE
python construct_loc_loc_graph.py --model_type transe --dataset <your_data_name> --pretrain_model <your_pretrained_model> --version scheme2 --threshold 10 --user_count 10000 --loc_count 10000
As for training the corresponding Graph-Flashback model, please refer to Model Training or (see scripts/run.sh) .
If you use Graph-Flashback in your research, please cite the following paper:
@inproceedings{DBLP:conf/kdd/RaoCLSYH22,
author = {Xuan Rao and
Lisi Chen and
Yong Liu and
Shuo Shang and
Bin Yao and
Peng Han},
title = {Graph-Flashback Network for Next Location Recommendation},
booktitle = {{KDD} '22: The 28th {ACM} {SIGKDD} Conference on Knowledge Discovery
and Data Mining, Washington, DC, USA, August 14 - 18, 2022},
year = {2022}
}