Skip to content
rnn based model for recommendations
Python Jupyter Notebook
Branch: master
Clone or download
Pull request Compare This branch is even with yufengwhy:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This repository contains my implementations of DREAM for next basket prediction. Besides I extendted the DREAM Framework to reorder prediction scenario. And it helped me earn 39/2669 place in Kaggle Instacart Reorder Prediction Competition. For anyone who is interested, please check this page for details about the Instacart competition.


DREAM uses RNN to capture sequential information of users' shopping behavior. It extracts users' dynamic representations and scores user-item pair by calculating inner products between users' dynamic representations and items' embedding.

Refer to the following paper:

Yu, Feng, et al. "A dynamic recurrent model for next basket recommendation." Proceedings of the 39th International ACM SIGIR conference on Research and Development in Information Retrieval. ACM, 2016.

for details about DREAM.


It runs on the Instacart dataset and can be used in other e-commerce datasets by modifying the input easily.


  • definition of DREAM

  • implementation of bpr loss function
  • implemeantation of reorder bpr loss function
  • training of DREAM

  • calculate <u,p> score using DREAM

  • input wrapper for DREAM
  • based on the Instacart Dataset

  • some useful functions

  • DREAM configurations

  • some constants such as file path

Make Recommendation Using DREAM.ipynb

  • using trained DREAM model to generate predictors for <u,p>


  • tensorboard
  • tensorboardX
  • pytorch == 0.3
  • pandas == 0.19.2
  • scikit-learn == 0.18.1

You need GPU to accelerate training.


Copyright (c) 2018 Yihong Chen

You can’t perform that action at this time.