Giter VIP home page Giter VIP logo

gru4rec-pytorch's Introduction

GRU4REC-PyTorch

Requirements

  • PyTorch 0.4.1
  • Python 3.5
  • pandas
  • numpy 1.14.5

Usage

Dataset

RecSys Challenge 2015 Dataset can be retreived from HERE

Pre processing data

  • You need to run preprocessing.py to obtain training data and testing data. In the paper, only the training set was used, the testing set is ignored.
  • The training set itself is divided into training and testing where the testing split is the last day sessions.

The format of data is similar to that obtained from RecSys Challenge 2015:

  • Filenames
    • Training set should be named as recSys15TrainOnly.txt
    • Test set should be named as recSys15Valid.txt
  • Contents
    • recSys15TrainOnly.txt, recSys15Valid.txt should be the tsv files that stores the pandas dataframes that satisfy the following requirements:
      • The 1st column of the file should be the integer Session IDs with header name SessionID
      • The 2nd column of the file should be the integer Item IDs with header name ItemID
      • The 3rd column of the file should be the Timestamps with header name Time

Training and Testing

The project have a structure as below:

├── GRU4REC-pytorch
│   ├── checkpoint
│   ├── data
│   │    ├── preprocessed_data
│   │    │    ├── recSys15TrainOnly.txt
│   │    │    ├── recSys15Valid.txt
│   │    ├── raw_data
│   │    │    ├── yoochoose-clicks.dat
│   ├── lib
│   ├── main.py
│   ├── preprocessing.py
│   ├── tool.py

tool.py can be used to get 1/8 last session from yoochoose-clicks.dat

In GRU4REC-pytorch

Training

python main.py

Testing

python main.py --is_eval --load_model checkpoint/CHECKPOINT#/model_EPOCH#.pt

List of Arguments accepted

--hidden_size Number of Neurons per Layer (Default = 100)
--num_layers Number of Hidden Layers (Default = 1)
--batch_size Batch Size (Default = 50)
--dropout_input Dropout ratio at input (Default = 0)
--dropout_hidden Dropout at each hidden layer except the last one (Default = 0.5)
--n_epochs Number of epochs (Default = 10)
--k_eval Value of K used durig Recall@K and MRR@K Evaluation (Default = 20)
--optimizer_type Optimizer (Default = Adagrad)
--final_act Activation Function (Default = Tanh)
--lr Learning rate (Default = 0.01)
--weight_decay Weight decay (Default = 0)
--momentum Momentum Value (Default = 0)
--eps Epsilon Value of Optimizer (Default = 1e-6)
--loss_type Type of loss function TOP1 / BPR / TOP1-max / BPR-max / Cross-Entropy (Default: TOP1-max)
--time_sort In case items are not sorted by time stamp (Default = 0)
--model_name String of model name.
--save_dir String of folder to save the checkpoints and logs inside it (Default = /checkpoint).
--data_folder String of the directory to the folder containing the dataset.
--train_data Name of the training dataset file (Default = recSys15TrainOnly.txt)
--valid_data Name of the validation dataset file (Default = recSys15Valid.txt)
--is_eval Should be used in case of evaluation only using a checkpoint model.
--load_model String containing the checkpoint model to be used in evaluation.
--checkpoint_dir String containing directory of the checkpoints folder.

Results

Different loss functions and different parameters have been tried out and the results can be seen from HERE

gru4rec-pytorch's People

Contributors

hungpthanh avatar mmaher22 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.