yingtaoluo / Spatial-Temporal-Attention-Network-for-POI-Recommendation

Codes for a WWW'21 Paper. POI recommender system for location/trajectory prediction.
https://doi.org/10.1145/3442381.3449998
170 stars 38 forks source link

Need help making inferences #6

Closed geekdev49 closed 3 years ago

geekdev49 commented 3 years ago

hi @yingtaoluo , need help regarding making inferences, i am trying to understand the paper, i am trying to use your helpful code and i was able to run the code successfully, after first running load.py, followed by train.py as you mentioned.

after completion of train.py, i now want to make inferences using the model. i see that you have an inference method in the train.py file but i basically want to predict the next poi any given user will visit at any given time, so basically my output schema is like -

can you please help me how do i get this after running train.py file, would be very much helpful

yingtaoluo commented 3 years ago

Ah, I do understand the problem you are facing. You wish to have a different division of train/dev/test sets. I think it may help to use a proportion of users as a training set and use the others as a dev/testing set, instead of using the last check-in as test data.

yingtaoluo commented 3 years ago

However, may I kindly inform you that this may not be fair? Our task here is to generalize for the future visits of each user we have known (so we do not test performance on past behavior), instead of generalizing to any users that we do not know (especially that their user-id embeddings are unknown to the model).

geekdev49 commented 3 years ago

Yes, I am looking for a similar kind of thing, I basically want to predict the future visits of the already existing users we have in the dataset(after model training has been completed), having trouble on how to get the possible future visit POIs for each user(already in the dataset), can you please guide on how do I get this for existing users, once I finish the training process, would be very helpful, thanks again!

yingtaoluo commented 3 years ago

I have added this good question to the FAQs. Thanks!

yingtaoluo commented 3 years ago

Yes, I am looking for a similar kind of thing, I basically want to predict the future visits of the already existing users we have in the dataset(after model training has been completed), having trouble on how to get the possible future visit POIs for each user(already in the dataset), can you please guide on how do I get this for existing users, once I finish the training process, would be very helpful, thanks again!

Oh, basically we do not use the last few steps and reserve them as a simulation of "future visits" since these steps are not fed into the model during training. In real applications, of course, every day we have new check-ins of the user, but that is a much more complex thing and we need to do things like online learning or dynamic training.

geekdev49 commented 3 years ago

Got it, I am actually looking to do this in an offline setting only, just wanted some help on how do I get the next forecasted visits given a user from the trained(.pth) model, if you can guide me to some code snippet that can help me achieve this, will be very much helpful.

yingtaoluo commented 3 years ago

Ah, sorry for this. A lot of people are emailing me about revising codes or potential original ideas. I do wish I have the time to revise codes for each one of you. :{