hidasib / GRU4Rec

GRU4Rec is the original Theano implementation of the algorithm in "Session-based Recommendations with Recurrent Neural Networks" paper, published at ICLR 2016 and its follow-up "Recurrent Neural Networks with Top-k Gains for Session-based Recommendations". The code is optimized for execution on the GPU.
Other
754 stars 223 forks source link

Non-session based custom dataset #48

Open halilergul1 opened 10 months ago

halilergul1 commented 10 months ago

Hi,

I want to try to train this model on my custom transactional dataset. I wonder whether [GRU4Rec] works intrinsically with session-based data. I have only item_id, user_id and time dimensions. Can I treat users as sessions or should I create a session dimension to run this model? Thanks in advance.

hidasib commented 10 months ago

The short answer is yes, but there are two things to keep in mind.

  1. In some cases user histories can be considered as sequences, but in other cases not. This depends on the domain, but also on what type of events you use. For example, purchase histories in general e-commerce (e.g, electronics) rarely exhibit sequential patterns, because the purchases are not really related directly (e.g. the phone I buy today is very loosely connected to the laptop I bought 6 months ago; those are two mostly unrelated problems from the user's perspective). On the other hand, if you take the item page view events of the same store, you'll probably see sequential patterns, because while I was looking for the laptop (or the phone) I went over a sequential process of finding the best one for me, looked at different options, changed my preferences slightly during the process, etc. Also, the events were close to each other in time so it is more likely that the existing sequential behaviour can be observed. But this is not only about the timeframe, regularity can be another factor. If you have experience with the domain from which you have the data, you can probably decide if the observable user behaviour - given the event type, regularity, resolution, etc - can be considered sequential. If you are unsure, one thing you can do is to separately run a hyperparameter optimization with GRU4Rec and "FFN4Rec" from here (which is basically the same algorithm, but with the GRU layer replaced with a feedforward network). If you get very similar final evaluation scores than there is probably no sequentiality in your data.

  2. If your user histories are long, the BPTT version of GRU4Rec can probably give you better results. It is not in the repo at the moment. (The base version should still work.)

halilergul1 commented 10 months ago

Thanks a lot for your detailed and helpful answer. My data is on e-commerce domain. It is transactional data.