Skip to content

Pytorch implementation of the paper "BPR: Bayesian Personalized Ranking from Implicit Feedback".

License

Notifications You must be signed in to change notification settings

KhalilDMK/BPR-Pytorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BPR-Pytorch

Pytorch implementation of the paper "BPR: Bayesian Personalized Ranking from Implicit Feedback".

Link to the paper: https://arxiv.org/ftp/arxiv/papers/1205/1205.2618.pdf

Environment settings

We use Pytorch 1.1.0.

Description

This repository includes code to train the BPR model and tune its hyperparameters: Run "Train_BPR.py". You can tune the hyperparameters by updating the configuration dictionary.

We made two evaluation procedures available (change "loo_eval" in the config dictionary):

  • Leave-One-Out evaluation: where the last interaction of each user is left out as test data and 100 negative items are sampled for each user. The positive item is ranked with respect to the negative items in terms of Hit ratio at cutoff K (HR@K) and Normalized Discounted Cumulative Gain at cutoff K (NDCG@K).
  • Explicit evaluation: random train/test split where the test items are ranked for each user in terms of Mean Average Precision at cutoff K (MAP@K) and Normalized Discounted Cumulative Gain at cutoff K (NDCG@K). The evaluation procedure uses the original explicit ratings to get the true rank of each item.

After training, the weights of the best model in terms of NDCG@K will be saved in an Output folder.

Datasets

You can train the model on the Movielens 100K and Movielens 1M datasets (Change the "dataset_name" variable).

About

Pytorch implementation of the paper "BPR: Bayesian Personalized Ranking from Implicit Feedback".

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages