The implementation of the PPR model(Personalized POI Recommendation).
Paper Personalized POI Recommendation:Spatio-Temporal Representation Learning with Social Tie
was accepted by DASFAA 2021.
Some questions about Embedding and line.cpp
, please refer to LINE (link: https://github.com/tangjianpku/LINE).
pip install -r requirements.txt
Clone this repo.
git clone https://github.com/dsj96/PPR-master
cd PPR-master
chmod u+x train_PPR.sh
-
gen_graph.py
file is used for heterogeneous graph construction. Parametertheta
is$\theta$ in Equ.2, andepsilon
is$\varepsilon$ in Equ.6. -
reconstruct.cpp
file is used for densifying graph. Parameter-threshold
is$\rho$ . -
line.cpp
file is used for learning latent representations. Parameter-size
is embedding dim$d$ . -
train.py
file is used for training and evaluating the spatio-temporal neural network. ParameterDELT_T
is the time constraint$\tau$ , andINPUT_SIZE/2
is the embedding dim$d$ . You could also change theHIDDEN_SIZE, EPOCH, LR, LAYERS OR TEST_SAMPLE_NUM
.
In our experiments, the Foursquare datasets are from https://sites.google.com/site/dbhongzhi/ (update: https://sites.google.com/view/hongzhi-yin/datasets). And the Gowalla and Brightkite dataset are from https://snap.stanford.edu/data/loc-gowalla.html and http://snap.stanford.edu/data/loc-Gowalla.html.
We utilize the first 80% chronological check-ins of each user as the training set, the remaining 20% as the test data.
train_checkin_file.txt and test_checkin_file.txt :
<USER ID> \t <CHECKIN TIME> \t <POI ID> \t <LONGITUDE> \t <LATITUDE>
friendship_file.txt : <USER ID>,<USER ID>
You can train and evaluate the model by: ./train_PPR.sh
Or you can run the specific program file separately, but the parameters should be reasonable (Although we have set some default parameters).
eg:
python3 gen_graph.py --input_path dataset/toyset/ --epsilon 0.5 --theta 24.0
python3 train.py --input_path dataset/toyset/ --input_size 16 --hidden_size 16 --layers 2 --lr 0.001 --delt_t 6.0 --epochs 20 --dr 0.2 --seed 1 --test_sample_num 300
Please cite our paper if you find this code useful for your research:
@inproceedings{dai2021personalized,
title={Personalized POI Recommendation: Spatio-Temporal Representation Learning with Social Tie.},
author={Dai, Shaojie and Yu, Yanwei and Fan, Hao and Dong, Junyu},
booktitle={DASFAA (1)},
pages={558--574},
year={2021}
}